Skip to content

Commit 7d9799f

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 7a3b1e2 commit 7d9799f

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
@@ -72,8 +72,11 @@ pub fn main() {
7272
exit(0);
7373
}
7474

75+
let mut orig_args: Vec<String> = env::args().collect();
76+
7577
let sys_root = option_env!("SYSROOT")
7678
.map(String::from)
79+
.or_else(|| arg_value(&orig_args, "--sysroot", |_| true).map(|s| s.to_string()))
7780
.or_else(|| std::env::var("SYSROOT").ok())
7881
.or_else(|| {
7982
let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME"));
@@ -93,7 +96,6 @@ pub fn main() {
9396

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

0 commit comments

Comments
 (0)