@@ -1988,7 +1988,7 @@ impl<'tcx> Operand<'tcx> {
1988
1988
pub fn to_copy ( & self ) -> Self {
1989
1989
match * self {
1990
1990
Operand :: Copy ( _) | Operand :: Constant ( _) => self . clone ( ) ,
1991
- Operand :: Move ( ref place) => Operand :: Copy ( place. clone ( ) ) ,
1991
+ Operand :: Move ( place) => Operand :: Copy ( place) ,
1992
1992
}
1993
1993
}
1994
1994
}
@@ -2462,11 +2462,15 @@ impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection {
2462
2462
let projs: Vec < _ > = self
2463
2463
. projs
2464
2464
. iter ( )
2465
- . map ( |elem| match elem {
2465
+ . map ( |& elem| match elem {
2466
2466
Deref => Deref ,
2467
- Field ( f, ( ) ) => Field ( f. clone ( ) , ( ) ) ,
2467
+ Field ( f, ( ) ) => Field ( f, ( ) ) ,
2468
2468
Index ( ( ) ) => Index ( ( ) ) ,
2469
- elem => elem. clone ( ) ,
2469
+ Downcast ( symbol, variantidx) => Downcast ( symbol, variantidx) ,
2470
+ ConstantIndex { offset, min_length, from_end } => {
2471
+ ConstantIndex { offset, min_length, from_end }
2472
+ }
2473
+ Subslice { from, to, from_end } => Subslice { from, to, from_end } ,
2470
2474
} )
2471
2475
. collect ( ) ;
2472
2476
@@ -2862,11 +2866,15 @@ impl<'tcx> TypeFoldable<'tcx> for PlaceElem<'tcx> {
2862
2866
fn super_fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
2863
2867
use crate :: mir:: ProjectionElem :: * ;
2864
2868
2865
- match self {
2869
+ match * self {
2866
2870
Deref => Deref ,
2867
- Field ( f, ty) => Field ( * f, ty. fold_with ( folder) ) ,
2871
+ Field ( f, ty) => Field ( f, ty. fold_with ( folder) ) ,
2868
2872
Index ( v) => Index ( v. fold_with ( folder) ) ,
2869
- elem => elem. clone ( ) ,
2873
+ Downcast ( symbol, variantidx) => Downcast ( symbol, variantidx) ,
2874
+ ConstantIndex { offset, min_length, from_end } => {
2875
+ ConstantIndex { offset, min_length, from_end }
2876
+ }
2877
+ Subslice { from, to, from_end } => Subslice { from, to, from_end } ,
2870
2878
}
2871
2879
}
2872
2880
@@ -2911,7 +2919,7 @@ impl<'tcx, R: Idx, C: Idx> TypeFoldable<'tcx> for BitMatrix<R, C> {
2911
2919
impl < ' tcx > TypeFoldable < ' tcx > for Constant < ' tcx > {
2912
2920
fn super_fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
2913
2921
Constant {
2914
- span : self . span . clone ( ) ,
2922
+ span : self . span ,
2915
2923
user_ty : self . user_ty . fold_with ( folder) ,
2916
2924
literal : self . literal . fold_with ( folder) ,
2917
2925
}
0 commit comments