diff options
Diffstat (limited to 'src/libfmt_macros/lib.rs')
| -rw-r--r-- | src/libfmt_macros/lib.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 24430b2e377..44cdb5e8a36 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -73,7 +73,9 @@ pub struct FormatSpec<'a> { /// Enum describing where an argument for a format can be located. #[derive(Copy, Clone, PartialEq)] pub enum Position<'a> { - /// The argument is located at a specific index. + /// The arugment is implied to be located at an index + ArgumentImplicitlyIs(usize), + /// The argument is located at a specific index given in the format ArgumentIs(usize), /// The argument has a name. ArgumentNamed(&'a str), @@ -275,7 +277,7 @@ impl<'a> Parser<'a> { None => { let i = self.curarg; self.curarg += 1; - ArgumentIs(i) + ArgumentImplicitlyIs(i) } }; @@ -517,7 +519,7 @@ mod tests { fn format_nothing() { same("{}", &[NextArgument(Argument { - position: ArgumentIs(0), + position: ArgumentImplicitlyIs(0), format: fmtdflt(), })]); } @@ -595,7 +597,7 @@ mod tests { fn format_counts() { same("{:10s}", &[NextArgument(Argument { - position: ArgumentIs(0), + position: ArgumentImplicitlyIs(0), format: FormatSpec { fill: None, align: AlignUnknown, @@ -607,7 +609,7 @@ mod tests { })]); same("{:10$.10s}", &[NextArgument(Argument { - position: ArgumentIs(0), + position: ArgumentImplicitlyIs(0), format: FormatSpec { fill: None, align: AlignUnknown, @@ -619,7 +621,7 @@ mod tests { })]); same("{:.*s}", &[NextArgument(Argument { - position: ArgumentIs(1), + position: ArgumentImplicitlyIs(1), format: FormatSpec { fill: None, align: AlignUnknown, @@ -631,7 +633,7 @@ mod tests { })]); same("{:.10$s}", &[NextArgument(Argument { - position: ArgumentIs(0), + position: ArgumentImplicitlyIs(0), format: FormatSpec { fill: None, align: AlignUnknown, @@ -643,7 +645,7 @@ mod tests { })]); same("{:a$.b$s}", &[NextArgument(Argument { - position: ArgumentIs(0), + position: ArgumentImplicitlyIs(0), format: FormatSpec { fill: None, align: AlignUnknown, @@ -658,7 +660,7 @@ mod tests { fn format_flags() { same("{:-}", &[NextArgument(Argument { - position: ArgumentIs(0), + position: ArgumentImplicitlyIs(0), format: FormatSpec { fill: None, align: AlignUnknown, @@ -670,7 +672,7 @@ mod tests { })]); same("{:+#}", &[NextArgument(Argument { - position: ArgumentIs(0), + position: ArgumentImplicitlyIs(0), format: FormatSpec { fill: None, align: AlignUnknown, |
