From 040f1c06bc7c1c5fa37477513227114d343b3ec3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 18 Sep 2013 13:51:07 -0700 Subject: Allow trailing commas in format! This is more consistent with other parts of the language and it also makes it easier to use in situations where format string is massive. --- src/libsyntax/ext/format.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 9f4e55b1a92..cace4648df2 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -76,6 +76,7 @@ impl Context { self.ecx.span_err(sp, "expected token: `,`"); return (extra, None); } + if *p.token == token::EOF { break } // accept trailing commas if named || (token::is_ident(p.token) && p.look_ahead(1, |t| *t == token::EQ)) { named = true; -- cgit 1.4.1-3-g733a5