From b820748ff5a2bc09b58dd7ac511e0f607d55f2e9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 10 Aug 2013 00:28:47 -0700 Subject: Implement formatting arguments for strings and integers Closes #1651 --- src/libsyntax/ext/ifmt.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ext/ifmt.rs b/src/libsyntax/ext/ifmt.rs index 65d2f798f31..66b091849c0 100644 --- a/src/libsyntax/ext/ifmt.rs +++ b/src/libsyntax/ext/ifmt.rs @@ -127,7 +127,13 @@ impl Context { } } parse::Argument(ref arg) => { - // argument first (it's first in the format string) + // width/precision first, if they have implicit positional + // parameters it makes more sense to consume them first. + self.verify_count(arg.format.width); + self.verify_count(arg.format.precision); + + // argument second, if it's an implicit positional parameter + // it's written second, so it should come after width/precision. let pos = match arg.position { parse::ArgumentNext => { let i = self.next_arg; @@ -144,10 +150,6 @@ impl Context { } else { Known(arg.format.ty.to_managed()) }; self.verify_arg_type(pos, ty); - // width/precision next - self.verify_count(arg.format.width); - self.verify_count(arg.format.precision); - // and finally the method being applied match arg.method { None => {} -- cgit 1.4.1-3-g733a5