@@ -4,7 +4,7 @@ use super::*;
44use crate :: ty;
55use rustc_data_structures:: functor:: IdFunctor ;
66
7- CloneTypeFoldableAndLiftImpls ! {
7+ TrivialTypeFoldableAndLiftImpls ! {
88 BlockTailInfo ,
99 MirPhase ,
1010 SourceInfo ,
@@ -24,7 +24,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
2424 SwitchInt { discr, switch_ty, targets } => SwitchInt {
2525 discr : discr. fold_with ( folder) ,
2626 switch_ty : switch_ty. fold_with ( folder) ,
27- targets : targets . clone ( ) ,
27+ targets,
2828 } ,
2929 Drop { place, target, unwind } => {
3030 Drop { place : place. fold_with ( folder) , target, unwind }
@@ -42,7 +42,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
4242 drop,
4343 } ,
4444 Call { func, args, destination, cleanup, from_hir_call, fn_span } => {
45- let dest = destination. as_ref ( ) . map ( |& ( loc, dest) | ( loc. fold_with ( folder) , dest) ) ;
45+ let dest = destination. map ( |( loc, dest) | ( loc. fold_with ( folder) , dest) ) ;
4646
4747 Call {
4848 func : func. fold_with ( folder) ,
@@ -63,7 +63,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
6363 OverflowNeg ( op) => OverflowNeg ( op. fold_with ( folder) ) ,
6464 DivisionByZero ( op) => DivisionByZero ( op. fold_with ( folder) ) ,
6565 RemainderByZero ( op) => RemainderByZero ( op. fold_with ( folder) ) ,
66- ResumedAfterReturn ( _) | ResumedAfterPanic ( _) => msg. clone ( ) ,
66+ ResumedAfterReturn ( _) | ResumedAfterPanic ( _) => msg,
6767 } ;
6868 Assert { cond : cond. fold_with ( folder) , expected, msg, target, cleanup }
6969 }
@@ -162,8 +162,7 @@ impl<'tcx> TypeFoldable<'tcx> for Place<'tcx> {
162162
163163impl < ' tcx > TypeFoldable < ' tcx > for & ' tcx ty:: List < PlaceElem < ' tcx > > {
164164 fn super_fold_with < F : TypeFolder < ' tcx > > ( self , folder : & mut F ) -> Self {
165- let v = self . iter ( ) . map ( |t| t. fold_with ( folder) ) . collect :: < Vec < _ > > ( ) ;
166- folder. tcx ( ) . intern_place_elems ( & v)
165+ ty:: util:: fold_list ( self , folder, |tcx, v| tcx. intern_place_elems ( v) )
167166 }
168167
169168 fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < ( ) > {
@@ -322,7 +321,7 @@ impl<'tcx> TypeFoldable<'tcx> for GeneratorSavedLocal {
322321
323322impl < ' tcx , R : Idx , C : Idx > TypeFoldable < ' tcx > for BitMatrix < R , C > {
324323 fn super_fold_with < F : TypeFolder < ' tcx > > ( self , _: & mut F ) -> Self {
325- self . clone ( )
324+ self
326325 }
327326 fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , _: & mut V ) -> ControlFlow < ( ) > {
328327 ControlFlow :: CONTINUE
0 commit comments