@@ -4,7 +4,7 @@ use super::*;
4
4
use crate :: ty;
5
5
use rustc_data_structures:: functor:: IdFunctor ;
6
6
7
- CloneTypeFoldableAndLiftImpls ! {
7
+ TrivialTypeFoldableAndLiftImpls ! {
8
8
BlockTailInfo ,
9
9
MirPhase ,
10
10
SourceInfo ,
@@ -24,7 +24,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
24
24
SwitchInt { discr, switch_ty, targets } => SwitchInt {
25
25
discr : discr. fold_with ( folder) ,
26
26
switch_ty : switch_ty. fold_with ( folder) ,
27
- targets : targets . clone ( ) ,
27
+ targets,
28
28
} ,
29
29
Drop { place, target, unwind } => {
30
30
Drop { place : place. fold_with ( folder) , target, unwind }
@@ -42,7 +42,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
42
42
drop,
43
43
} ,
44
44
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) ) ;
46
46
47
47
Call {
48
48
func : func. fold_with ( folder) ,
@@ -63,7 +63,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
63
63
OverflowNeg ( op) => OverflowNeg ( op. fold_with ( folder) ) ,
64
64
DivisionByZero ( op) => DivisionByZero ( op. fold_with ( folder) ) ,
65
65
RemainderByZero ( op) => RemainderByZero ( op. fold_with ( folder) ) ,
66
- ResumedAfterReturn ( _) | ResumedAfterPanic ( _) => msg. clone ( ) ,
66
+ ResumedAfterReturn ( _) | ResumedAfterPanic ( _) => msg,
67
67
} ;
68
68
Assert { cond : cond. fold_with ( folder) , expected, msg, target, cleanup }
69
69
}
@@ -162,8 +162,7 @@ impl<'tcx> TypeFoldable<'tcx> for Place<'tcx> {
162
162
163
163
impl < ' tcx > TypeFoldable < ' tcx > for & ' tcx ty:: List < PlaceElem < ' tcx > > {
164
164
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) )
167
166
}
168
167
169
168
fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < ( ) > {
@@ -322,7 +321,7 @@ impl<'tcx> TypeFoldable<'tcx> for GeneratorSavedLocal {
322
321
323
322
impl < ' tcx , R : Idx , C : Idx > TypeFoldable < ' tcx > for BitMatrix < R , C > {
324
323
fn super_fold_with < F : TypeFolder < ' tcx > > ( self , _: & mut F ) -> Self {
325
- self . clone ( )
324
+ self
326
325
}
327
326
fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , _: & mut V ) -> ControlFlow < ( ) > {
328
327
ControlFlow :: CONTINUE
0 commit comments