Rust

Rust

Made by DeepSource

Found string literal in env functions RS-W1015

Bug risk
Major

Calls to the std::env functions that use string literals instead of a static strings can lead to bugs due to spelling errors.

Consider using a static string to refer to environment variables.

Bad practice

std::env::var("RUST_BACKTRACE");
// elsewhere ...
std::env::remove_var("RUST_BACKTRCAE"); // misspelled

Recommended

static RUST_BACKTRACE: &str = "RUST_BACKTRACE";
std::env::var(RUST_BACKTRACE);
std::env::remove_var(RUST_BACKTRACE);