Skip to content

Commit

Permalink
clippy-driver: if --sysroot is specified on the command line, use that
Browse files Browse the repository at this point in the history
If the user explicitly sets sysroot on the command line, then use that
value.

Issue #3663
  • Loading branch information
jsgf committed Jan 18, 2019
1 parent 7a3b1e2 commit 7d9799f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ pub fn main() {
exit(0);
}

let mut orig_args: Vec<String> = env::args().collect();

let sys_root = option_env!("SYSROOT")
.map(String::from)
.or_else(|| arg_value(&orig_args, "--sysroot", |_| true).map(|s| s.to_string()))
.or_else(|| std::env::var("SYSROOT").ok())
.or_else(|| {
let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME"));
Expand All @@ -93,7 +96,6 @@ pub fn main() {

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

0 comments on commit 7d9799f

Please sign in to comment.