Skip to content

Commit

Permalink
Clean up formatvar identifier construction
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 8, 2024
1 parent 17fa0d2 commit 24e7f87
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions impl/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,10 @@ impl Display<'_> {
}
_ => continue,
};
let mut formatvar = match &member {
MemberUnraw::Unnamed(index) => IdentUnraw::new(format_ident!("__field{}", index)),
MemberUnraw::Named(ident) => {
IdentUnraw::new(format_ident!("__field_{}", ident.to_string()))
}
};
let mut formatvar = IdentUnraw::new(match &member {
MemberUnraw::Unnamed(index) => format_ident!("__field{}", index),
MemberUnraw::Named(ident) => format_ident!("__field_{}", ident.to_string()),
});
while user_named_args.contains(&formatvar) {
formatvar = IdentUnraw::new(format_ident!("_{}", formatvar.to_string()));
}
Expand Down

0 comments on commit 24e7f87

Please sign in to comment.