@@ -1003,12 +1003,11 @@ impl<'p, 'tcx: 'p> PatCx for RustcPatCtxt<'p, 'tcx> {
1003
1003
}
1004
1004
// `pat` is an exclusive range like `lo..gap`. `gapped_with` contains ranges that start with
1005
1005
// `gap+1`.
1006
- let suggested_range: thir :: Pat < ' _ > = {
1006
+ let suggested_range: String = {
1007
1007
// Suggest `lo..=gap` instead.
1008
- let mut suggested_range = thir_pat. clone ( ) ;
1009
- let thir:: PatKind :: Range ( range) = & mut suggested_range. kind else { unreachable ! ( ) } ;
1010
- range. end = rustc_hir:: RangeEnd :: Included ;
1011
- suggested_range
1008
+ let mut suggested_range = PatRange :: clone ( range) ;
1009
+ suggested_range. end = rustc_hir:: RangeEnd :: Included ;
1010
+ suggested_range. to_string ( )
1012
1011
} ;
1013
1012
let gap_as_pat = self . hoist_pat_range ( & gap, * pat. ty ( ) ) ;
1014
1013
if gapped_with. is_empty ( ) {
@@ -1023,7 +1022,7 @@ impl<'p, 'tcx: 'p> PatCx for RustcPatCtxt<'p, 'tcx> {
1023
1022
// That's the gap that isn't covered.
1024
1023
max : gap_as_pat. to_string ( ) ,
1025
1024
// Suggest `lo..=max` instead.
1026
- suggestion : suggested_range. to_string ( ) ,
1025
+ suggestion : suggested_range,
1027
1026
} ,
1028
1027
) ;
1029
1028
} else {
@@ -1037,15 +1036,15 @@ impl<'p, 'tcx: 'p> PatCx for RustcPatCtxt<'p, 'tcx> {
1037
1036
// That's the gap that isn't covered.
1038
1037
gap : gap_as_pat. to_string ( ) ,
1039
1038
// Suggest `lo..=gap` instead.
1040
- suggestion : suggested_range. to_string ( ) ,
1039
+ suggestion : suggested_range,
1041
1040
// All these ranges skipped over `gap` which we think is probably a
1042
1041
// mistake.
1043
1042
gap_with : gapped_with
1044
1043
. iter ( )
1045
1044
. map ( |pat| errors:: GappedRange {
1046
1045
span : pat. data ( ) . span ,
1047
1046
gap : gap_as_pat. to_string ( ) ,
1048
- first_range : thir_pat . to_string ( ) ,
1047
+ first_range : range . to_string ( ) ,
1049
1048
} )
1050
1049
. collect ( ) ,
1051
1050
} ,
0 commit comments