@@ -365,23 +365,9 @@ struct LiteralExpander;
365
365
impl < ' tcx > PatternFolder < ' tcx > for LiteralExpander {
366
366
fn fold_pattern ( & mut self , pat : & Pat < ' tcx > ) -> Pat < ' tcx > {
367
367
debug ! ( "fold_pattern {:?} {:?} {:?}" , pat, pat. ty. kind( ) , pat. kind) ;
368
- match ( pat. ty . kind ( ) , pat. kind . as_ref ( ) ) {
369
- ( _, PatKind :: Binding { subpattern : Some ( s) , .. } ) => s. fold_with ( self ) ,
370
- ( _, PatKind :: AscribeUserType { subpattern : s, .. } ) => s. fold_with ( self ) ,
371
- ( ty:: Ref ( _, t, _) , PatKind :: Constant { .. } ) if t. is_str ( ) => {
372
- // Treat string literal patterns as deref patterns to a `str` constant, i.e.
373
- // `&CONST`. This expands them like other const patterns. This could have been done
374
- // in `const_to_pat`, but that causes issues with the rest of the matching code.
375
- let mut new_pat = pat. super_fold_with ( self ) ;
376
- // Make a fake const pattern of type `str` (instead of `&str`). That the carried
377
- // constant value still knows it is of type `&str`.
378
- new_pat. ty = t;
379
- Pat {
380
- kind : Box :: new ( PatKind :: Deref { subpattern : new_pat } ) ,
381
- span : pat. span ,
382
- ty : pat. ty ,
383
- }
384
- }
368
+ match pat. kind . as_ref ( ) {
369
+ PatKind :: Binding { subpattern : Some ( s) , .. } => s. fold_with ( self ) ,
370
+ PatKind :: AscribeUserType { subpattern : s, .. } => s. fold_with ( self ) ,
385
371
_ => pat. super_fold_with ( self ) ,
386
372
}
387
373
}
@@ -1183,7 +1169,7 @@ fn is_useful<'p, 'tcx>(
1183
1169
let ctor_wild_subpatterns = Fields :: wildcards ( pcx. cx , pcx. ty , & ctor) ;
1184
1170
let spec_matrix =
1185
1171
start_matrix. specialize_constructor ( pcx, & ctor, & ctor_wild_subpatterns) ;
1186
- let v = v. pop_head_constructor ( pcx . cx , & ctor_wild_subpatterns) ;
1172
+ let v = v. pop_head_constructor ( cx, & ctor_wild_subpatterns) ;
1187
1173
let usefulness =
1188
1174
is_useful ( cx, & spec_matrix, & v, witness_preference, hir_id, is_under_guard, false ) ;
1189
1175
let usefulness =
0 commit comments