@@ -413,12 +413,10 @@ impl<'a, 'b> Context<'a, 'b> {
413
413
parse:: CountIs ( i) => count ( "Is" , Some ( self . ecx . expr_usize ( sp, i) ) ) ,
414
414
parse:: CountIsParam ( i) => {
415
415
// This needs mapping too, as `i` is referring to a macro
416
- // argument.
417
- let i = match self . count_positions . get ( & i) {
418
- Some ( & i) => i,
419
- None => 0 , // error already emitted elsewhere
420
- } ;
421
- let i = i + self . count_args_index_offset ;
416
+ // argument. If `i` is not found in `count_positions` then
417
+ // the error had already been emitted elsewhere.
418
+ let i = self . count_positions . get ( & i) . cloned ( ) . unwrap_or ( 0 )
419
+ + self . count_args_index_offset ;
422
420
count ( "Param" , Some ( self . ecx . expr_usize ( sp, i) ) )
423
421
}
424
422
parse:: CountImplied => count ( "Implied" , None ) ,
@@ -503,10 +501,7 @@ impl<'a, 'b> Context<'a, 'b> {
503
501
} ,
504
502
} ;
505
503
506
- let fill = match arg. format . fill {
507
- Some ( c) => c,
508
- None => ' ' ,
509
- } ;
504
+ let fill = arg. format . fill . unwrap_or ( ' ' ) ;
510
505
511
506
if * arg != simple_arg || fill != ' ' {
512
507
self . all_pieces_simple = false ;
@@ -805,8 +800,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
805
800
if !parser. errors . is_empty ( ) {
806
801
let err = parser. errors . remove ( 0 ) ;
807
802
let sp = fmt. span . from_inner_byte_pos ( err. start , err. end ) ;
808
- let mut e = ecx. struct_span_err ( sp, & format ! ( "invalid format string: {}" ,
809
- err. description) ) ;
803
+ let mut e = ecx. struct_span_err ( sp, & format ! ( "invalid format string: {}" , err. description) ) ;
810
804
e. span_label ( sp, err. label + " in format string" ) ;
811
805
if let Some ( note) = err. note {
812
806
e. note ( & note) ;
0 commit comments