@@ -541,7 +541,7 @@ impl<'a, 'b> Context<'a, 'b> {
541
541
) {
542
542
match c {
543
543
parse:: CountImplied | parse:: CountIs ( ..) => { }
544
- parse:: CountIsParam ( i) => {
544
+ parse:: CountIsParam ( i) | parse :: CountIsStar ( i ) => {
545
545
self . unused_names_lint . maybe_add_positional_named_arg (
546
546
self . args . get ( i) ,
547
547
named_arg_type,
@@ -589,7 +589,7 @@ impl<'a, 'b> Context<'a, 'b> {
589
589
+ self
590
590
. arg_with_formatting
591
591
. iter ( )
592
- . filter ( |fmt| matches ! ( fmt. precision, parse:: CountIsParam ( _) ) )
592
+ . filter ( |fmt| matches ! ( fmt. precision, parse:: CountIsStar ( _) ) )
593
593
. count ( ) ;
594
594
if self . names . is_empty ( ) && !numbered_position_args && count != self . num_args ( ) {
595
595
e = self . ecx . struct_span_err (
@@ -639,7 +639,7 @@ impl<'a, 'b> Context<'a, 'b> {
639
639
if let Some ( span) = fmt. precision_span {
640
640
let span = self . fmtsp . from_inner ( InnerSpan :: new ( span. start , span. end ) ) ;
641
641
match fmt. precision {
642
- parse:: CountIsParam ( pos) if pos > self . num_args ( ) => {
642
+ parse:: CountIsParam ( pos) if pos >= self . num_args ( ) => {
643
643
e. span_label (
644
644
span,
645
645
& format ! (
@@ -651,12 +651,12 @@ impl<'a, 'b> Context<'a, 'b> {
651
651
) ;
652
652
zero_based_note = true ;
653
653
}
654
- parse:: CountIsParam ( pos) => {
654
+ parse:: CountIsStar ( pos) => {
655
655
let count = self . pieces . len ( )
656
656
+ self
657
657
. arg_with_formatting
658
658
. iter ( )
659
- . filter ( |fmt| matches ! ( fmt. precision, parse:: CountIsParam ( _) ) )
659
+ . filter ( |fmt| matches ! ( fmt. precision, parse:: CountIsStar ( _) ) )
660
660
. count ( ) ;
661
661
e. span_label (
662
662
span,
@@ -837,7 +837,7 @@ impl<'a, 'b> Context<'a, 'b> {
837
837
} ;
838
838
match c {
839
839
parse:: CountIs ( i) => count ( sym:: Is , Some ( self . ecx . expr_usize ( sp, i) ) ) ,
840
- parse:: CountIsParam ( i) => {
840
+ parse:: CountIsParam ( i) | parse :: CountIsStar ( i ) => {
841
841
// This needs mapping too, as `i` is referring to a macro
842
842
// argument. If `i` is not found in `count_positions` then
843
843
// the error had already been emitted elsewhere.
0 commit comments