Skip to content

Commit 3058865

Browse files
committed
avoid unnecessary nested conditionals
1 parent 03b24f2 commit 3058865

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -228,17 +228,15 @@ impl<'tcx> ConstToPat<'tcx> {
228228
}
229229
}
230230
}
231-
} else if !self.saw_const_match_lint.get() {
232-
if !have_valtree {
233-
// The only way valtree construction can fail without the structural match
234-
// checker finding a violation is if there is a pointer somewhere.
235-
self.tcx().emit_spanned_lint(
236-
lint::builtin::POINTER_STRUCTURAL_MATCH,
237-
self.id,
238-
self.span,
239-
PointerPattern,
240-
);
241-
}
231+
} else if !have_valtree && !self.saw_const_match_lint.get() {
232+
// The only way valtree construction can fail without the structural match
233+
// checker finding a violation is if there is a pointer somewhere.
234+
self.tcx().emit_spanned_lint(
235+
lint::builtin::POINTER_STRUCTURAL_MATCH,
236+
self.id,
237+
self.span,
238+
PointerPattern,
239+
);
242240
}
243241

244242
// Always check for `PartialEq`, even if we emitted other lints. (But not if there were

0 commit comments

Comments
 (0)