diff options
| author | Ralf Jung <post@ralfj.de> | 2025-05-17 10:07:20 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-05-17 10:07:30 +0200 |
| commit | b99daba38e3005f7e430655abf6138b4d9fc03e3 (patch) | |
| tree | fd34b42a93abca1fc1499a4713462a07cbb96a82 | |
| parent | 8f2da9b487f47827d565c52e019db5a464f31808 (diff) | |
| download | rust-b99daba38e3005f7e430655abf6138b4d9fc03e3.tar.gz rust-b99daba38e3005f7e430655abf6138b4d9fc03e3.zip | |
fix clippy lints
| -rw-r--r-- | src/tools/miri/cargo-miri/src/setup.rs | 8 | ||||
| -rw-r--r-- | src/tools/miri/miri-script/src/commands.rs | 14 | ||||
| -rw-r--r-- | src/tools/miri/src/shims/panic.rs | 1 | ||||
| -rw-r--r-- | src/tools/miri/tests/ui.rs | 8 |
4 files changed, 13 insertions, 18 deletions
diff --git a/src/tools/miri/cargo-miri/src/setup.rs b/src/tools/miri/cargo-miri/src/setup.rs index 7afc8481009..b9b58c04f9e 100644 --- a/src/tools/miri/cargo-miri/src/setup.rs +++ b/src/tools/miri/cargo-miri/src/setup.rs @@ -24,11 +24,9 @@ pub fn setup( let ask_user = !only_setup; let print_sysroot = only_setup && has_arg_flag("--print-sysroot"); // whether we just print the sysroot path let show_setup = only_setup && !print_sysroot; - if !only_setup { - if let Some(sysroot) = std::env::var_os("MIRI_SYSROOT") { - // Skip setup step if MIRI_SYSROOT is explicitly set, *unless* we are `cargo miri setup`. - return sysroot.into(); - } + if !only_setup && let Some(sysroot) = std::env::var_os("MIRI_SYSROOT") { + // Skip setup step if MIRI_SYSROOT is explicitly set, *unless* we are `cargo miri setup`. + return sysroot.into(); } // Determine where the rust sources are located. The env var trumps auto-detection. diff --git a/src/tools/miri/miri-script/src/commands.rs b/src/tools/miri/miri-script/src/commands.rs index 1c9750e2cbd..3b7b159aeab 100644 --- a/src/tools/miri/miri-script/src/commands.rs +++ b/src/tools/miri/miri-script/src/commands.rs @@ -675,11 +675,9 @@ impl Command { let mut early_flags = Vec::<OsString>::new(); // In `dep` mode, the target is already passed via `MIRI_TEST_TARGET` - if !dep { - if let Some(target) = &target { - early_flags.push("--target".into()); - early_flags.push(target.into()); - } + if !dep && let Some(target) = &target { + early_flags.push("--target".into()); + early_flags.push(target.into()); } early_flags.push("--edition".into()); early_flags.push(edition.as_deref().unwrap_or("2021").into()); @@ -707,10 +705,8 @@ impl Command { // Add Miri flags let mut cmd = cmd.args(&miri_flags).args(&early_flags).args(&flags); // For `--dep` we also need to set the target in the env var. - if dep { - if let Some(target) = &target { - cmd = cmd.env("MIRI_TEST_TARGET", target); - } + if dep && let Some(target) = &target { + cmd = cmd.env("MIRI_TEST_TARGET", target); } // Finally, run the thing. Ok(cmd.run()?) diff --git a/src/tools/miri/src/shims/panic.rs b/src/tools/miri/src/shims/panic.rs index 18af8214876..b5ed5ea837b 100644 --- a/src/tools/miri/src/shims/panic.rs +++ b/src/tools/miri/src/shims/panic.rs @@ -85,6 +85,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Now we make a function call, and pass `data` as first and only argument. let f_instance = this.get_ptr_fn(try_fn)?.as_instance()?; trace!("try_fn: {:?}", f_instance); + #[allow(clippy::cloned_ref_to_slice_refs)] // the code is clearer as-is this.call_function( f_instance, ExternAbi::Rust, diff --git a/src/tools/miri/tests/ui.rs b/src/tools/miri/tests/ui.rs index a7b889d966c..46472b51f9c 100644 --- a/src/tools/miri/tests/ui.rs +++ b/src/tools/miri/tests/ui.rs @@ -318,10 +318,10 @@ fn main() -> Result<()> { let mut args = std::env::args_os(); // Skip the program name and check whether this is a `./miri run-dep` invocation - if let Some(first) = args.nth(1) { - if first == "--miri-run-dep-mode" { - return run_dep_mode(target, args); - } + if let Some(first) = args.nth(1) + && first == "--miri-run-dep-mode" + { + return run_dep_mode(target, args); } ui(Mode::Pass, "tests/pass", &target, WithoutDependencies, tmpdir.path())?; |
