Skip to content

Commit

Permalink
Improve code readability by using for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
celinval authored and compiler-errors committed Nov 7, 2024
1 parent 97607a0 commit 8544742
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compiler/stable_mir/src/mir/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ impl Debug for Place {
pub(crate) fn function_body<W: Write>(writer: &mut W, body: &Body, name: &str) -> io::Result<()> {
write!(writer, "fn {name}(")?;
let mut sep = "";
body.arg_locals().iter().enumerate().try_for_each(|(index, local)| {
for (index, local) in body.arg_locals().iter().enumerate() {
write!(writer, "{}_{}: {}", sep, index + 1, local.ty)?;
sep = ", ";
io::Result::Ok(())
})?;
}
write!(writer, ")")?;

let return_local = body.ret_local();
Expand Down

0 comments on commit 8544742

Please sign in to comment.