diff options
Diffstat (limited to 'src/tools/clippy/src/driver.rs')
-rw-r--r-- | src/tools/clippy/src/driver.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tools/clippy/src/driver.rs b/src/tools/clippy/src/driver.rs index 9ec4df8e6..d521e8d88 100644 --- a/src/tools/clippy/src/driver.rs +++ b/src/tools/clippy/src/driver.rs @@ -19,7 +19,6 @@ extern crate rustc_span; use rustc_interface::interface; use rustc_session::parse::ParseSess; use rustc_span::symbol::Symbol; -use rustc_tools_util::VersionInfo; use std::borrow::Cow; use std::env; @@ -257,11 +256,14 @@ pub fn main() { LazyLock::force(&ICE_HOOK); exit(rustc_driver::catch_with_exit_code(move || { let mut orig_args: Vec<String> = env::args().collect(); + let has_sysroot_arg = arg_value(&orig_args, "--sysroot", |_| true).is_some(); let sys_root_env = std::env::var("SYSROOT").ok(); let pass_sysroot_env_if_given = |args: &mut Vec<String>, sys_root_env| { if let Some(sys_root) = sys_root_env { - args.extend(vec!["--sysroot".into(), sys_root]); + if !has_sysroot_arg { + args.extend(vec!["--sysroot".into(), sys_root]); + } }; }; |