make matches exhaustive

This commit is contained in:
Matthias Krüger 2020-01-26 14:17:22 +01:00
parent ec61761e46
commit f7dcdcc0b9

View file

@ -2462,11 +2462,15 @@ impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection {
let projs: Vec<_> = self
.projs
.iter()
.map(|elem| match elem {
.map(|&elem| match elem {
Deref => Deref,
Field(f, ()) => Field(*f, ()),
Field(f, ()) => Field(f, ()),
Index(()) => Index(()),
elem => *elem,
Downcast(symbol, variantidx) => Downcast(symbol, variantidx),
ConstantIndex { offset, min_length, from_end } => {
ConstantIndex { offset, min_length, from_end }
}
Subslice { from, to, from_end } => Subslice { from, to, from_end },
})
.collect();
@ -2862,11 +2866,15 @@ impl<'tcx> TypeFoldable<'tcx> for PlaceElem<'tcx> {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
use crate::mir::ProjectionElem::*;
match self {
match *self {
Deref => Deref,
Field(f, ty) => Field(*f, ty.fold_with(folder)),
Field(f, ty) => Field(f, ty.fold_with(folder)),
Index(v) => Index(v.fold_with(folder)),
elem => *elem,
Downcast(symbol, variantidx) => Downcast(symbol, variantidx),
ConstantIndex { offset, min_length, from_end } => {
ConstantIndex { offset, min_length, from_end }
}
Subslice { from, to, from_end } => Subslice { from, to, from_end },
}
}