Skip to content

Commit

Permalink
Slightly cleaner implementation of has_trailing_comma
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 5, 2024
1 parent b54f231 commit 51ccdf1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions impl/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ impl Display<'_> {

let mut has_trailing_comma = false;
if let Some(TokenTree::Punct(punct)) = args.clone().into_iter().last() {
if punct.as_char() == ',' {
has_trailing_comma = true;
}
has_trailing_comma = punct.as_char() == ',';
}

self.requires_fmt_machinery = self.requires_fmt_machinery || fmt.contains('}');
Expand Down

0 comments on commit 51ccdf1

Please sign in to comment.