Update wording and use if let

This commit is contained in:
Nick Flueckiger 2021-02-14 13:00:20 +01:00
parent 86c6e42741
commit d3aed3585e
2 changed files with 10 additions and 13 deletions

View file

@ -572,15 +572,12 @@ impl Config {
return;
}
match self.upper_case_env.get(key.as_env_key()) {
Some(env_key) => {
let _ = self.shell().warn(format!(
"Environment variables require uppercase letters, \
but the variable: `{}` contains lowercase letters or dashes.",
env_key
));
}
None => {}
if let Some(env_key) = self.upper_case_env.get(key.as_env_key()) {
let _ = self.shell().warn(format!(
"Environment variables are expected to use uppercase letters and underscores, \
the variable {} will be ignored and have no effect",
env_key
));
}
}

View file

@ -368,8 +368,8 @@ fn target_in_environment_contains_lower_case() {
.env(target_key, "nonexistent-linker")
.with_status(101)
.with_stderr_contains(format!(
"warning: Environment variables require uppercase letters, \
but the variable: `{}` contains lowercase letters or dashes.",
"warning: Environment variables are expected to use uppercase letters and underscores, \
the variable {} will be ignored and have no effect",
target_key
))
.run();
@ -391,8 +391,8 @@ fn target_in_environment_contains_lower_case_on_windows() {
.env(target_key, "nonexistent-linker")
.with_status(101)
.with_stderr_does_not_contain(format!(
"warning: Environment variables require uppercase letters, \
but the variable: `{}` contains lowercase letters or dashes.",
"warning: Environment variables are expected to use uppercase letters and underscores, \
the variable {} will be ignored and have no effect",
target_key
))
.run();