From 51ccdf18f51b501c51faa9f9181d4a87aefea78f Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 4 Nov 2024 20:48:22 -0500 Subject: [PATCH] Slightly cleaner implementation of has_trailing_comma --- impl/src/fmt.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/impl/src/fmt.rs b/impl/src/fmt.rs index f46c128..bc6f3dc 100644 --- a/impl/src/fmt.rs +++ b/impl/src/fmt.rs @@ -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('}');