Separate CountIsStar from CountIsParam in rustc_parse_format.
This commit is contained in:
parent
4d45b0745a
commit
1b044da5bb
3 changed files with 10 additions and 8 deletions
|
@ -167,6 +167,8 @@ pub enum Count<'a> {
|
|||
CountIsName(&'a str, InnerSpan),
|
||||
/// The count is specified by the argument at the given index.
|
||||
CountIsParam(usize),
|
||||
/// The count is specified by a star (like in `{:.*}`) that refers to the argument at the given index.
|
||||
CountIsStar(usize),
|
||||
/// The count is implied and cannot be explicitly specified.
|
||||
CountImplied,
|
||||
}
|
||||
|
@ -618,7 +620,7 @@ impl<'a> Parser<'a> {
|
|||
// We can do this immediately as `position` is resolved later.
|
||||
let i = self.curarg;
|
||||
self.curarg += 1;
|
||||
spec.precision = CountIsParam(i);
|
||||
spec.precision = CountIsStar(i);
|
||||
} else {
|
||||
spec.precision = self.count(start + 1);
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ fn format_counts() {
|
|||
fill: None,
|
||||
align: AlignUnknown,
|
||||
flags: 0,
|
||||
precision: CountIsParam(0),
|
||||
precision: CountIsStar(0),
|
||||
precision_span: Some(InnerSpan { start: 3, end: 5 }),
|
||||
width: CountImplied,
|
||||
width_span: None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue