bless clippy
This commit is contained in:
parent
543afa8896
commit
5a5a3e4ef4
@ -4,5 +4,5 @@ fn main() {
|
||||
// Re-export the TARGET environment variable so it can
|
||||
// be accessed by miri.
|
||||
let target = std::env::var("TARGET").unwrap();
|
||||
println!("cargo:rustc-env=TARGET={}", target);
|
||||
println!("cargo:rustc-env=TARGET={target}");
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ Examples:
|
||||
"#;
|
||||
|
||||
fn show_help() {
|
||||
println!("{}", CARGO_MIRI_HELP);
|
||||
println!("{CARGO_MIRI_HELP}");
|
||||
}
|
||||
|
||||
fn show_version() {
|
||||
@ -52,7 +52,7 @@ fn forward_patched_extern_arg(args: &mut impl Iterator<Item = String>, cmd: &mut
|
||||
let path = args.next().expect("`--extern` should be followed by a filename");
|
||||
if let Some(lib) = path.strip_suffix(".rlib") {
|
||||
// If this is an rlib, make it an rmeta.
|
||||
cmd.arg(format!("{}.rmeta", lib));
|
||||
cmd.arg(format!("{lib}.rmeta"));
|
||||
} else {
|
||||
// Some other extern file (e.g. a `.so`). Forward unchanged.
|
||||
cmd.arg(path);
|
||||
@ -336,7 +336,7 @@ pub fn phase_rustc(mut args: impl Iterator<Item = String>, phase: RustcPhase) {
|
||||
"[cargo-miri rustc inside rustdoc] captured input:\n{}",
|
||||
std::str::from_utf8(&env.stdin).unwrap()
|
||||
);
|
||||
eprintln!("[cargo-miri rustc inside rustdoc] going to run:\n{:?}", cmd);
|
||||
eprintln!("[cargo-miri rustc inside rustdoc] going to run:\n{cmd:?}");
|
||||
}
|
||||
|
||||
exec_with_pipe(cmd, &env.stdin, format!("{}.stdin", out_filename("", "").display()));
|
||||
@ -374,7 +374,7 @@ pub fn phase_rustc(mut args: impl Iterator<Item = String>, phase: RustcPhase) {
|
||||
val.push("metadata");
|
||||
}
|
||||
}
|
||||
cmd.arg(format!("{}={}", emit_flag, val.join(",")));
|
||||
cmd.arg(format!("{emit_flag}={}", val.join(",")));
|
||||
} else if arg == "--extern" {
|
||||
// Patch `--extern` filenames, since Cargo sometimes passes stub `.rlib` files:
|
||||
// https://github.com/rust-lang/miri/issues/1705
|
||||
@ -535,7 +535,7 @@ pub fn phase_runner(mut binary_args: impl Iterator<Item = String>, phase: Runner
|
||||
// Run it.
|
||||
debug_cmd("[cargo-miri runner]", verbose, &cmd);
|
||||
match phase {
|
||||
RunnerPhase::Rustdoc => exec_with_pipe(cmd, &info.stdin, format!("{}.stdin", binary)),
|
||||
RunnerPhase::Rustdoc => exec_with_pipe(cmd, &info.stdin, format!("{binary}.stdin")),
|
||||
RunnerPhase::Cargo => exec(cmd),
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ pub fn escape_for_toml(s: &str) -> String {
|
||||
// We want to surround this string in quotes `"`. So we first escape all quotes,
|
||||
// and also all backslashes (that are used to escape quotes).
|
||||
let s = s.replace('\\', r#"\\"#).replace('"', r#"\""#);
|
||||
format!("\"{}\"", s)
|
||||
format!("\"{s}\"")
|
||||
}
|
||||
|
||||
/// Returns the path to the `miri` binary
|
||||
@ -175,7 +175,7 @@ pub fn ask_to_run(mut cmd: Command, ask: bool, text: &str) {
|
||||
let is_ci = env::var_os("CI").is_some() || env::var_os("TF_BUILD").is_some();
|
||||
if ask && !is_ci {
|
||||
let mut buf = String::new();
|
||||
print!("I will run `{:?}` to {}. Proceed? [Y/n] ", cmd, text);
|
||||
print!("I will run `{cmd:?}` to {text}. Proceed? [Y/n] ");
|
||||
io::stdout().flush().unwrap();
|
||||
io::stdin().read_line(&mut buf).unwrap();
|
||||
match buf.trim().to_lowercase().as_ref() {
|
||||
@ -185,10 +185,10 @@ pub fn ask_to_run(mut cmd: Command, ask: bool, text: &str) {
|
||||
a => show_error!("invalid answer `{}`", a),
|
||||
};
|
||||
} else {
|
||||
eprintln!("Running `{:?}` to {}.", cmd, text);
|
||||
eprintln!("Running `{cmd:?}` to {text}.");
|
||||
}
|
||||
|
||||
if cmd.status().unwrap_or_else(|_| panic!("failed to execute {:?}", cmd)).success().not() {
|
||||
if cmd.status().unwrap_or_else(|_| panic!("failed to execute {cmd:?}")).success().not() {
|
||||
show_error!("failed to {}", text);
|
||||
}
|
||||
}
|
||||
@ -276,12 +276,12 @@ pub fn debug_cmd(prefix: &str, verbose: usize, cmd: &Command) {
|
||||
// Print only what has been changed for this `cmd`.
|
||||
for (var, val) in cmd.get_envs() {
|
||||
if let Some(val) = val {
|
||||
writeln!(out, "{}={:?} \\", var.to_string_lossy(), val).unwrap();
|
||||
writeln!(out, "{}={val:?} \\", var.to_string_lossy()).unwrap();
|
||||
} else {
|
||||
writeln!(out, "--unset={}", var.to_string_lossy()).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
write!(out, "{cmd:?}").unwrap();
|
||||
eprintln!("{}", out);
|
||||
eprintln!("{out}");
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ fn init_late_loggers(tcx: TyCtxt<'_>) {
|
||||
if log::Level::from_str(&var).is_ok() {
|
||||
env::set_var(
|
||||
"RUSTC_LOG",
|
||||
&format!(
|
||||
format!(
|
||||
"rustc_middle::mir::interpret={0},rustc_const_eval::interpret={0}",
|
||||
var
|
||||
),
|
||||
@ -243,7 +243,7 @@ fn host_sysroot() -> Option<String> {
|
||||
)
|
||||
}
|
||||
}
|
||||
format!("{}/toolchains/{}", home, toolchain)
|
||||
format!("{home}/toolchains/{toolchain}")
|
||||
}
|
||||
_ => option_env!("RUST_SYSROOT")
|
||||
.unwrap_or_else(|| {
|
||||
@ -330,7 +330,7 @@ fn main() {
|
||||
} else if crate_kind == "host" {
|
||||
false
|
||||
} else {
|
||||
panic!("invalid `MIRI_BE_RUSTC` value: {:?}", crate_kind)
|
||||
panic!("invalid `MIRI_BE_RUSTC` value: {crate_kind:?}")
|
||||
};
|
||||
|
||||
// We cannot use `rustc_driver::main` as we need to adjust the CLI arguments.
|
||||
|
@ -399,7 +399,7 @@ mod tests {
|
||||
|
||||
//Test partial_cmp
|
||||
let compare = l.partial_cmp(&r);
|
||||
assert_eq!(compare, o, "Invalid comparison\n l: {:?}\n r: {:?}", l, r);
|
||||
assert_eq!(compare, o, "Invalid comparison\n l: {l:?}\n r: {r:?}");
|
||||
let alt_compare = r.partial_cmp(&l);
|
||||
assert_eq!(
|
||||
alt_compare,
|
||||
|
@ -263,7 +263,7 @@ pub fn report_error<'tcx, 'mir>(
|
||||
msg.insert(0, e.to_string());
|
||||
report_msg(
|
||||
DiagLevel::Error,
|
||||
&if let Some(title) = title { format!("{}: {}", title, msg[0]) } else { msg[0].clone() },
|
||||
&if let Some(title) = title { format!("{title}: {}", msg[0]) } else { msg[0].clone() },
|
||||
msg,
|
||||
vec![],
|
||||
helps,
|
||||
|
@ -107,7 +107,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
/// Gets an instance for a path.
|
||||
fn resolve_path(&self, path: &[&str]) -> ty::Instance<'tcx> {
|
||||
self.try_resolve_path(path)
|
||||
.unwrap_or_else(|| panic!("failed to find required Rust item: {:?}", path))
|
||||
.unwrap_or_else(|| panic!("failed to find required Rust item: {path:?}"))
|
||||
}
|
||||
|
||||
/// Evaluates the scalar at the specified path. Returns Some(val)
|
||||
@ -505,7 +505,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
RejectOpWith::WarningWithoutBacktrace => {
|
||||
this.tcx
|
||||
.sess
|
||||
.warn(&format!("{} was made to return an error due to isolation", op_name));
|
||||
.warn(format!("{op_name} was made to return an error due to isolation"));
|
||||
Ok(())
|
||||
}
|
||||
RejectOpWith::Warning => {
|
||||
|
@ -191,12 +191,12 @@ impl interpret::Provenance for Provenance {
|
||||
Provenance::Concrete { alloc_id, sb } => {
|
||||
// Forward `alternate` flag to `alloc_id` printing.
|
||||
if f.alternate() {
|
||||
write!(f, "[{:#?}]", alloc_id)?;
|
||||
write!(f, "[{alloc_id:#?}]")?;
|
||||
} else {
|
||||
write!(f, "[{:?}]", alloc_id)?;
|
||||
write!(f, "[{alloc_id:?}]")?;
|
||||
}
|
||||
// Print Stacked Borrows tag.
|
||||
write!(f, "{:?}", sb)?;
|
||||
write!(f, "{sb:?}")?;
|
||||
}
|
||||
Provenance::Wildcard => {
|
||||
write!(f, "[wildcard]")?;
|
||||
|
@ -40,7 +40,7 @@ impl<T> RangeMap<T> {
|
||||
let mut left = 0usize; // inclusive
|
||||
let mut right = self.v.len(); // exclusive
|
||||
loop {
|
||||
debug_assert!(left < right, "find_offset: offset {} is out-of-bounds", offset);
|
||||
debug_assert!(left < right, "find_offset: offset {offset} is out-of-bounds");
|
||||
let candidate = left.checked_add(right).unwrap() / 2;
|
||||
let elem = &self.v[candidate];
|
||||
if offset < elem.range.start {
|
||||
|
@ -321,7 +321,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
return Ok(Some(body));
|
||||
}
|
||||
|
||||
this.handle_unsupported(format!("can't call foreign function: {}", link_name))?;
|
||||
this.handle_unsupported(format!("can't call foreign function: {link_name}"))?;
|
||||
return Ok(None);
|
||||
}
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
return Ok(-1);
|
||||
}
|
||||
|
||||
let fd = options.open(&path).map(|file| {
|
||||
let fd = options.open(path).map(|file| {
|
||||
let fh = &mut this.machine.file_handler;
|
||||
fh.insert_fd(Box::new(FileHandle { file, writable }))
|
||||
});
|
||||
@ -1862,7 +1862,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
|
||||
let possibly_unique = std::env::temp_dir().join::<PathBuf>(p.into());
|
||||
|
||||
let file = fopts.open(&possibly_unique);
|
||||
let file = fopts.open(possibly_unique);
|
||||
|
||||
match file {
|
||||
Ok(f) => {
|
||||
|
@ -126,7 +126,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
futex(this, &args[1..], dest)?;
|
||||
}
|
||||
id => {
|
||||
this.handle_unsupported(format!("can't execute syscall with ID {}", id))?;
|
||||
this.handle_unsupported(format!("can't execute syscall with ID {id}"))?;
|
||||
return Ok(EmulateByNameResult::AlreadyJumped);
|
||||
}
|
||||
}
|
||||
|
@ -86,12 +86,12 @@ impl Invalidation {
|
||||
impl fmt::Display for InvalidationCause {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
InvalidationCause::Access(kind) => write!(f, "{}", kind),
|
||||
InvalidationCause::Access(kind) => write!(f, "{kind}"),
|
||||
InvalidationCause::Retag(perm, kind) =>
|
||||
if *kind == RetagCause::FnEntry {
|
||||
write!(f, "{:?} FnEntry retag", perm)
|
||||
write!(f, "{perm:?} FnEntry retag")
|
||||
} else {
|
||||
write!(f, "{:?} retag", perm)
|
||||
write!(f, "{perm:?} retag")
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -339,7 +339,7 @@ impl<'span, 'history, 'ecx, 'mir, 'tcx> DiagnosticCx<'span, 'history, 'ecx, 'mir
|
||||
// this allocation.
|
||||
if self.history.base.0.tag() == tag {
|
||||
Some((
|
||||
format!("{:?} was created here, as the base tag for {:?}", tag, self.history.id),
|
||||
format!("{tag:?} was created here, as the base tag for {:?}", self.history.id),
|
||||
self.history.base.1.data()
|
||||
))
|
||||
} else {
|
||||
@ -381,7 +381,7 @@ impl<'span, 'history, 'ecx, 'mir, 'tcx> DiagnosticCx<'span, 'history, 'ecx, 'mir
|
||||
self.offset.bytes(),
|
||||
);
|
||||
err_sb_ub(
|
||||
format!("{}{}", action, error_cause(stack, op.orig_tag)),
|
||||
format!("{action}{}", error_cause(stack, op.orig_tag)),
|
||||
Some(operation_summary(&op.cause.summary(), self.history.id, op.range)),
|
||||
op.orig_tag.and_then(|orig_tag| self.get_logs_relevant_to(orig_tag, None)),
|
||||
)
|
||||
@ -401,7 +401,7 @@ impl<'span, 'history, 'ecx, 'mir, 'tcx> DiagnosticCx<'span, 'history, 'ecx, 'mir
|
||||
offset = self.offset.bytes(),
|
||||
);
|
||||
err_sb_ub(
|
||||
format!("{}{}", action, error_cause(stack, op.tag)),
|
||||
format!("{action}{}", error_cause(stack, op.tag)),
|
||||
Some(operation_summary("an access", self.history.id, op.range)),
|
||||
op.tag.and_then(|tag| self.get_logs_relevant_to(tag, None)),
|
||||
)
|
||||
|
@ -1153,7 +1153,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
let alloc_extra = this.get_alloc_extra(alloc_id)?;
|
||||
let stacks = alloc_extra.stacked_borrows.as_ref().unwrap().borrow();
|
||||
for (range, stack) in stacks.stacks.iter_all() {
|
||||
print!("{:?}: [", range);
|
||||
print!("{range:?}: [");
|
||||
for i in 0..stack.len() {
|
||||
let item = stack.get(i).unwrap();
|
||||
print!(" {:?}{:?}", item.perm(), item.tag());
|
||||
|
Loading…
x
Reference in New Issue
Block a user