fix clippy lints

This commit is contained in:
Ralf Jung 2025-05-17 10:07:20 +02:00
parent 8f2da9b487
commit b99daba38e
4 changed files with 13 additions and 18 deletions

View file

@ -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.

View file

@ -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()?)

View file

@ -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,

View file

@ -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())?;