Skip to content

Commit dd4b95f

Browse files
author
Nick Flueckiger
committed
Lint
1 parent a7ae635 commit dd4b95f

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

src/cargo/util/config/mod.rs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,14 @@ impl Config {
213213
})
214214
.collect();
215215

216-
let mut upper_case_env : HashMap<String, String> = HashMap::new();
216+
let mut upper_case_env: HashMap<String, String> = HashMap::new();
217217

218218
if !cfg!(windows) {
219-
upper_case_env = env.clone().into_iter().map(|(k, _)| {
220-
(k.to_uppercase().replace("-", "_"), k)
221-
}).collect();
219+
upper_case_env = env
220+
.clone()
221+
.into_iter()
222+
.map(|(k, _)| (k.to_uppercase().replace("-", "_"), k))
223+
.collect();
222224
}
223225

224226
let cache_rustc_info = match env.get("CARGO_CACHE_RUSTC_INFO") {
@@ -539,7 +541,7 @@ impl Config {
539541
None => {
540542
self.check_environment_key_case_mismatch(key);
541543
Ok(None)
542-
},
544+
}
543545
}
544546
}
545547

@@ -568,14 +570,15 @@ impl Config {
568570
if cfg!(windows) {
569571
return;
570572
}
571-
match self.upper_case_env.get(key.as_env_key()){
573+
match self.upper_case_env.get(key.as_env_key()) {
572574
Some(env_key) => {
573-
let _ = self.shell().warn(
574-
format!("Variables in environment require uppercase,
575-
but given variable: {}, contains lowercase or dash.", env_key)
576-
);
577-
},
578-
None => {},
575+
let _ = self.shell().warn(format!(
576+
"Variables in environment require uppercase,
577+
but given variable: {}, contains lowercase or dash.",
578+
env_key
579+
));
580+
}
581+
None => {}
579582
}
580583
}
581584

@@ -673,8 +676,8 @@ impl Config {
673676
Some(v) => v,
674677
None => {
675678
self.check_environment_key_case_mismatch(key);
676-
return Ok(())
677-
},
679+
return Ok(());
680+
}
678681
};
679682

680683
let def = Definition::Environment(key.as_env_key().to_string());

tests/testsuite/tool_paths.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,23 +353,25 @@ fn custom_linker_env() {
353353
.run();
354354
}
355355

356-
357356
#[cargo_test]
358357
#[cfg(not(windows))]
359358
fn target_in_environment_contains_lower_case() {
360359
let p = project().file("src/main.rs", "fn main() {}").build();
361360

362-
let target_keys = ["CARGO_TARGET_X86_64_UNKNOWN_LINUX_musl_LINKER",
363-
"CARGO_TARGET_x86_64_unknown_linux_musl_LINKER"];
361+
let target_keys = [
362+
"CARGO_TARGET_X86_64_UNKNOWN_LINUX_musl_LINKER",
363+
"CARGO_TARGET_x86_64_unknown_linux_musl_LINKER",
364+
];
364365

365366
for target_key in &target_keys {
366367
p.cargo("build -v --target X86_64_unknown_linux_musl")
367368
.env(target_key, "nonexistent-linker")
368369
.with_status(101)
369-
.with_stderr_contains(
370-
format!("warning: Variables in environment require uppercase,
371-
but given variable: {}, contains lowercase or dash.", target_key)
372-
)
370+
.with_stderr_contains(format!(
371+
"warning: Variables in environment require uppercase,
372+
but given variable: {}, contains lowercase or dash.",
373+
target_key
374+
))
373375
.run();
374376
}
375377
}

0 commit comments

Comments
 (0)