Skip to content

Commit 132c086

Browse files
committed
clippy-driver: if --sysroot is specified on the command line, use that
If the user explicitly sets sysroot on the command line, then use that value. Issue #3663
1 parent 227c72d commit 132c086

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/driver.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ pub fn main() {
6969
exit(0);
7070
}
7171

72+
let mut orig_args: Vec<String> = env::args().collect();
73+
7274
let sys_root = option_env!("SYSROOT")
7375
.map(String::from)
76+
.or_else(|| arg_value(&orig_args, "--sysroot", |_| true).map(|s| s.to_string()))
7477
.or_else(|| std::env::var("SYSROOT").ok())
7578
.or_else(|| {
7679
let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME"));
@@ -90,7 +93,6 @@ pub fn main() {
9093

9194
// Setting RUSTC_WRAPPER causes Cargo to pass 'rustc' as the first argument.
9295
// We're invoking the compiler programmatically, so we ignore this/
93-
let mut orig_args: Vec<String> = env::args().collect();
9496
if orig_args.len() <= 1 {
9597
std::process::exit(1);
9698
}

0 commit comments

Comments
 (0)