From d3d59055a9f8a7a34d70b581638ef8b56e68d0b4 Mon Sep 17 00:00:00 2001 From: Michal Piotrowski Date: Tue, 15 Oct 2024 13:49:07 +0200 Subject: [PATCH] Fix uninlined_format_args in stable_mir --- compiler/stable_mir/src/mir/pretty.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/stable_mir/src/mir/pretty.rs b/compiler/stable_mir/src/mir/pretty.rs index 74081af1d86d0..05d11c71bbbe1 100644 --- a/compiler/stable_mir/src/mir/pretty.rs +++ b/compiler/stable_mir/src/mir/pretty.rs @@ -22,7 +22,7 @@ impl Debug for Place { } pub(crate) fn function_body(writer: &mut W, body: &Body, name: &str) -> io::Result<()> { - write!(writer, "fn {}(", name)?; + write!(writer, "fn {name}(")?; body.arg_locals() .iter() .enumerate() @@ -54,7 +54,7 @@ pub(crate) fn function_body(writer: &mut W, body: &Body, name: &str) - .iter() .enumerate() .map(|(index, block)| -> io::Result<()> { - writeln!(writer, " bb{}: {{", index)?; + writeln!(writer, " bb{index}: {{")?; let _ = block .statements .iter() @@ -75,7 +75,7 @@ pub(crate) fn function_body(writer: &mut W, body: &Body, name: &str) - fn pretty_statement(writer: &mut W, statement: &StatementKind) -> io::Result<()> { match statement { StatementKind::Assign(place, rval) => { - write!(writer, " {:?} = ", place)?; + write!(writer, " {place:?} = ")?; pretty_rvalue(writer, rval)?; writeln!(writer, ";") } @@ -165,7 +165,7 @@ fn pretty_terminator_head(writer: &mut W, terminator: &TerminatorKind) Abort => write!(writer, "{INDENT}abort"), Return => write!(writer, "{INDENT}return"), Unreachable => write!(writer, "{INDENT}unreachable"), - Drop { place, .. } => write!(writer, "{INDENT}drop({:?})", place), + Drop { place, .. } => write!(writer, "{INDENT}drop({place:?})"), Call { func, args, destination, .. } => { write!(writer, "{INDENT}{:?} = {}(", destination, pretty_operand(func))?; let mut args_iter = args.iter(); @@ -304,10 +304,10 @@ fn pretty_assert_message(writer: &mut W, msg: &AssertMessage) -> io::R fn pretty_operand(operand: &Operand) -> String { match operand { Operand::Copy(copy) => { - format!("{:?}", copy) + format!("{copy:?}") } Operand::Move(mv) => { - format!("move {:?}", mv) + format!("move {mv:?}") } Operand::Constant(cnst) => pretty_mir_const(&cnst.const_), } @@ -344,13 +344,13 @@ fn pretty_rvalue(writer: &mut W, rval: &Rvalue) -> io::Result<()> { write!(writer, "Checked{:?}({}, {})", bin, pretty_operand(op1), pretty_operand(op2)) } Rvalue::CopyForDeref(deref) => { - write!(writer, "CopyForDeref({:?})", deref) + write!(writer, "CopyForDeref({deref:?})") } Rvalue::Discriminant(place) => { - write!(writer, "discriminant({:?})", place) + write!(writer, "discriminant({place:?})") } Rvalue::Len(len) => { - write!(writer, "len({:?})", len) + write!(writer, "len({len:?})") } Rvalue::Ref(_, borrowkind, place) => { let kind = match borrowkind { @@ -359,17 +359,17 @@ fn pretty_rvalue(writer: &mut W, rval: &Rvalue) -> io::Result<()> { BorrowKind::Fake(FakeBorrowKind::Shallow) => "&fake shallow ", BorrowKind::Mut { .. } => "&mut ", }; - write!(writer, "{kind}{:?}", place) + write!(writer, "{kind}{place:?}") } Rvalue::Repeat(op, cnst) => { write!(writer, "{} \" \" {}", pretty_operand(op), pretty_ty_const(cnst)) } Rvalue::ShallowInitBox(_, _) => Ok(()), Rvalue::ThreadLocalRef(item) => { - write!(writer, "thread_local_ref{:?}", item) + write!(writer, "thread_local_ref{item:?}") } Rvalue::NullaryOp(nul, ty) => { - write!(writer, "{:?} {} \" \"", nul, ty) + write!(writer, "{nul:?} {ty} \" \"") } Rvalue::UnaryOp(un, op) => { write!(writer, "{} \" \" {:?}", pretty_operand(op), un)