Skip to content

Commit d3aed35

Browse files
author
Nick Flueckiger
committed
Update wording and use if let
1 parent 86c6e42 commit d3aed35

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/cargo/util/config/mod.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -572,15 +572,12 @@ impl Config {
572572
return;
573573
}
574574

575-
match self.upper_case_env.get(key.as_env_key()) {
576-
Some(env_key) => {
577-
let _ = self.shell().warn(format!(
578-
"Environment variables require uppercase letters, \
579-
but the variable: `{}` contains lowercase letters or dashes.",
580-
env_key
581-
));
582-
}
583-
None => {}
575+
if let Some(env_key) = self.upper_case_env.get(key.as_env_key()) {
576+
let _ = self.shell().warn(format!(
577+
"Environment variables are expected to use uppercase letters and underscores, \
578+
the variable {} will be ignored and have no effect",
579+
env_key
580+
));
584581
}
585582
}
586583

tests/testsuite/tool_paths.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,8 @@ fn target_in_environment_contains_lower_case() {
368368
.env(target_key, "nonexistent-linker")
369369
.with_status(101)
370370
.with_stderr_contains(format!(
371-
"warning: Environment variables require uppercase letters, \
372-
but the variable: `{}` contains lowercase letters or dashes.",
371+
"warning: Environment variables are expected to use uppercase letters and underscores, \
372+
the variable {} will be ignored and have no effect",
373373
target_key
374374
))
375375
.run();
@@ -391,8 +391,8 @@ fn target_in_environment_contains_lower_case_on_windows() {
391391
.env(target_key, "nonexistent-linker")
392392
.with_status(101)
393393
.with_stderr_does_not_contain(format!(
394-
"warning: Environment variables require uppercase letters, \
395-
but the variable: `{}` contains lowercase letters or dashes.",
394+
"warning: Environment variables are expected to use uppercase letters and underscores, \
395+
the variable {} will be ignored and have no effect",
396396
target_key
397397
))
398398
.run();

0 commit comments

Comments
 (0)