@@ -11,7 +11,7 @@ use rustc_hir::def::{DefKind, Res};
1111use rustc_hir:: intravisit:: { Visitor , walk_pat} ;
1212use rustc_hir:: { Arm , Expr , ExprKind , HirId , Node , Pat , PatKind , QPath , StmtKind } ;
1313use rustc_lint:: LateContext ;
14- use rustc_middle:: ty:: { self , AdtDef , ParamEnv , TyCtxt , TypeckResults , VariantDef } ;
14+ use rustc_middle:: ty:: { self , AdtDef , TyCtxt , TypeckResults , VariantDef } ;
1515use rustc_span:: { Span , sym} ;
1616
1717use super :: { MATCH_BOOL , SINGLE_MATCH , SINGLE_MATCH_ELSE } ;
@@ -67,7 +67,6 @@ pub(crate) fn check<'tcx>(cx: &LateContext<'tcx>, ex: &'tcx Expr<'_>, arms: &'tc
6767 if v. has_enum {
6868 let cx = PatCtxt {
6969 tcx : cx. tcx ,
70- param_env : cx. param_env ,
7170 typeck,
7271 arena : DroplessArena :: default ( ) ,
7372 } ;
@@ -185,7 +184,6 @@ impl<'tcx> Visitor<'tcx> for PatVisitor<'tcx> {
185184/// The context needed to manipulate a `PatState`.
186185struct PatCtxt < ' tcx > {
187186 tcx : TyCtxt < ' tcx > ,
188- param_env : ParamEnv < ' tcx > ,
189187 typeck : & ' tcx TypeckResults < ' tcx > ,
190188 arena : DroplessArena ,
191189}
@@ -334,7 +332,7 @@ impl<'a> PatState<'a> {
334332 if match * cx. typeck . pat_ty ( pat) . peel_refs ( ) . kind ( ) {
335333 ty:: Adt ( adt, _) => adt. is_enum ( ) || ( adt. is_struct ( ) && !adt. non_enum_variant ( ) . fields . is_empty ( ) ) ,
336334 ty:: Tuple ( tys) => !tys. is_empty ( ) ,
337- ty:: Array ( _, len) => len. try_eval_target_usize ( cx. tcx , cx . param_env ) != Some ( 1 ) ,
335+ ty:: Array ( _, len) => len. try_to_target_usize ( cx. tcx ) != Some ( 1 ) ,
338336 ty:: Slice ( ..) => true ,
339337 _ => false ,
340338 } =>
@@ -353,7 +351,7 @@ impl<'a> PatState<'a> {
353351 } ,
354352 PatKind :: Slice ( [ sub_pat] , _, [ ] ) | PatKind :: Slice ( [ ] , _, [ sub_pat] )
355353 if let ty:: Array ( _, len) = * cx. typeck . pat_ty ( pat) . kind ( )
356- && len. try_eval_target_usize ( cx. tcx , cx . param_env ) == Some ( 1 ) =>
354+ && len. try_to_target_usize ( cx. tcx ) == Some ( 1 ) =>
357355 {
358356 self . add_pat ( cx, sub_pat)
359357 } ,
0 commit comments