Skip to content

Commit b99daba

Browse files
committed
fix clippy lints
1 parent 8f2da9b commit b99daba

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

src/tools/miri/cargo-miri/src/setup.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ pub fn setup(
2424
let ask_user = !only_setup;
2525
let print_sysroot = only_setup && has_arg_flag("--print-sysroot"); // whether we just print the sysroot path
2626
let show_setup = only_setup && !print_sysroot;
27-
if !only_setup {
28-
if let Some(sysroot) = std::env::var_os("MIRI_SYSROOT") {
29-
// Skip setup step if MIRI_SYSROOT is explicitly set, *unless* we are `cargo miri setup`.
30-
return sysroot.into();
31-
}
27+
if !only_setup && let Some(sysroot) = std::env::var_os("MIRI_SYSROOT") {
28+
// Skip setup step if MIRI_SYSROOT is explicitly set, *unless* we are `cargo miri setup`.
29+
return sysroot.into();
3230
}
3331

3432
// Determine where the rust sources are located. The env var trumps auto-detection.

src/tools/miri/miri-script/src/commands.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -675,11 +675,9 @@ impl Command {
675675
let mut early_flags = Vec::<OsString>::new();
676676

677677
// In `dep` mode, the target is already passed via `MIRI_TEST_TARGET`
678-
if !dep {
679-
if let Some(target) = &target {
680-
early_flags.push("--target".into());
681-
early_flags.push(target.into());
682-
}
678+
if !dep && let Some(target) = &target {
679+
early_flags.push("--target".into());
680+
early_flags.push(target.into());
683681
}
684682
early_flags.push("--edition".into());
685683
early_flags.push(edition.as_deref().unwrap_or("2021").into());
@@ -707,10 +705,8 @@ impl Command {
707705
// Add Miri flags
708706
let mut cmd = cmd.args(&miri_flags).args(&early_flags).args(&flags);
709707
// For `--dep` we also need to set the target in the env var.
710-
if dep {
711-
if let Some(target) = &target {
712-
cmd = cmd.env("MIRI_TEST_TARGET", target);
713-
}
708+
if dep && let Some(target) = &target {
709+
cmd = cmd.env("MIRI_TEST_TARGET", target);
714710
}
715711
// Finally, run the thing.
716712
Ok(cmd.run()?)

src/tools/miri/src/shims/panic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8585
// Now we make a function call, and pass `data` as first and only argument.
8686
let f_instance = this.get_ptr_fn(try_fn)?.as_instance()?;
8787
trace!("try_fn: {:?}", f_instance);
88+
#[allow(clippy::cloned_ref_to_slice_refs)] // the code is clearer as-is
8889
this.call_function(
8990
f_instance,
9091
ExternAbi::Rust,

src/tools/miri/tests/ui.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,10 @@ fn main() -> Result<()> {
318318
let mut args = std::env::args_os();
319319

320320
// Skip the program name and check whether this is a `./miri run-dep` invocation
321-
if let Some(first) = args.nth(1) {
322-
if first == "--miri-run-dep-mode" {
323-
return run_dep_mode(target, args);
324-
}
321+
if let Some(first) = args.nth(1)
322+
&& first == "--miri-run-dep-mode"
323+
{
324+
return run_dep_mode(target, args);
325325
}
326326

327327
ui(Mode::Pass, "tests/pass", &target, WithoutDependencies, tmpdir.path())?;

0 commit comments

Comments
 (0)