Open philipjonsen opened 2 months ago
DESCRIPTION:
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);
rust-bitcoincore-rpc/blob/master/integration_test/src/main.rs#L112-L119
I also noticed that almost every non-symbol string in this codebase could be spelled wrong. Maybe we should use cpp to substitute every single string for one that has extra "s?
cpp
DESCRIPTION:
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);
rust-bitcoincore-rpc/blob/master/integration_test/src/main.rs#L112-L119