File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
src/librustc_mir/hair/pattern Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -489,17 +489,16 @@ fn check_exhaustive<'tcx>(
489
489
490
490
fn joined_uncovered_patterns ( witnesses : & [ & Pattern < ' _ > ] ) -> String {
491
491
const LIMIT : usize = 3 ;
492
- match witnesses. len ( ) {
493
- 0 => bug ! ( ) ,
494
- 1 => format ! ( "`{}`" , witnesses[ 0 ] ) ,
495
- 2 ..=LIMIT => {
496
- let ( tail, head) = witnesses. split_last ( ) . unwrap ( ) ;
497
- let head: Vec < _ > = head. iter ( ) . map ( |w| w. to_string ( ) ) . collect ( ) ;
492
+ match witnesses {
493
+ [ ] => bug ! ( ) ,
494
+ [ witness] => format ! ( "`{}`" , witness) ,
495
+ [ head @ .., tail] if head. len ( ) < LIMIT => {
496
+ let head: Vec < _ > = head. iter ( ) . map ( <_ >:: to_string) . collect ( ) ;
498
497
format ! ( "`{}` and `{}`" , head. join( "`, `" ) , tail)
499
498
}
500
499
_ => {
501
500
let ( head, tail) = witnesses. split_at ( LIMIT ) ;
502
- let head: Vec < _ > = head. iter ( ) . map ( |w| w . to_string ( ) ) . collect ( ) ;
501
+ let head: Vec < _ > = head. iter ( ) . map ( < _ > :: to_string) . collect ( ) ;
503
502
format ! ( "`{}` and {} more" , head. join( "`, `" ) , tail. len( ) )
504
503
}
505
504
}
You can’t perform that action at this time.
0 commit comments