We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 99ec14d + 040f1c0 commit da29a8eCopy full SHA for da29a8e
src/libsyntax/ext/format.rs
@@ -76,6 +76,7 @@ impl Context {
76
self.ecx.span_err(sp, "expected token: `,`");
77
return (extra, None);
78
}
79
+ if *p.token == token::EOF { break } // accept trailing commas
80
if named || (token::is_ident(p.token) &&
81
p.look_ahead(1, |t| *t == token::EQ)) {
82
named = true;
src/test/run-pass/ifmt.rs
@@ -243,6 +243,10 @@ pub fn main() {
243
244
245
test_format_args();
246
+
247
+ // test that trailing commas are acceptable
248
+ format!("{}", "test",);
249
+ format!("{foo}", foo="test",);
250
251
252
// Basic test to make sure that we can invoke the `write!` macro with an
0 commit comments