1
Fork 0

Drop an if let that will always succeed

We've already checked that `proj_base == []` in the line above and renaming
`place_local` to `local` doesn't gain us anything.
This commit is contained in:
LingMan 2021-06-05 18:12:47 +02:00
parent 5ea19239d9
commit f4080fca62

View file

@ -729,15 +729,13 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
let base_ty = Place::ty_from(place_local, proj_base, self.body, self.tcx).ty; let base_ty = Place::ty_from(place_local, proj_base, self.body, self.tcx).ty;
if let ty::RawPtr(_) = base_ty.kind() { if let ty::RawPtr(_) = base_ty.kind() {
if proj_base.is_empty() { if proj_base.is_empty() {
if let (local, []) = (place_local, proj_base) { let decl = &self.body.local_decls[place_local];
let decl = &self.body.local_decls[local];
if let Some(box LocalInfo::StaticRef { def_id, .. }) = decl.local_info { if let Some(box LocalInfo::StaticRef { def_id, .. }) = decl.local_info {
let span = decl.source_info.span; let span = decl.source_info.span;
self.check_static(def_id, span); self.check_static(def_id, span);
return; return;
} }
} }
}
self.check_op(ops::RawPtrDeref); self.check_op(ops::RawPtrDeref);
} }