Skip to content

Commit 01bbae8

Browse files
Rollup merge of rust-lang#86028 - LingMan:dupe_empty_check, r=jyn514
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. `@rustbot` modify labels +C-cleanup +T-compiler
2 parents 1542950 + f4080fc commit 01bbae8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

compiler/rustc_mir/src/transform/check_consts/validation.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -729,13 +729,11 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
729729
let base_ty = Place::ty_from(place_local, proj_base, self.body, self.tcx).ty;
730730
if let ty::RawPtr(_) = base_ty.kind() {
731731
if proj_base.is_empty() {
732-
if let (local, []) = (place_local, proj_base) {
733-
let decl = &self.body.local_decls[local];
734-
if let Some(box LocalInfo::StaticRef { def_id, .. }) = decl.local_info {
735-
let span = decl.source_info.span;
736-
self.check_static(def_id, span);
737-
return;
738-
}
732+
let decl = &self.body.local_decls[place_local];
733+
if let Some(box LocalInfo::StaticRef { def_id, .. }) = decl.local_info {
734+
let span = decl.source_info.span;
735+
self.check_static(def_id, span);
736+
return;
739737
}
740738
}
741739
self.check_op(ops::RawPtrDeref);

0 commit comments

Comments
 (0)