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>(
489489
490490fn joined_uncovered_patterns ( witnesses : & [ & Pattern < ' _ > ] ) -> String {
491491 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 ( ) ;
498497 format ! ( "`{}` and `{}`" , head. join( "`, `" ) , tail)
499498 }
500499 _ => {
501500 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 ( ) ;
503502 format ! ( "`{}` and {} more" , head. join( "`, `" ) , tail. len( ) )
504503 }
505504 }
You can’t perform that action at this time.
0 commit comments