diff options
| author | Ralf Jung <post@ralfj.de> | 2023-11-08 20:37:08 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-11-08 20:37:08 +0100 |
| commit | 30588657b753b9ae500b3514d58da18a4a155b08 (patch) | |
| tree | d5293d1684680bcfd1937314032a03c381bd2ed5 /compiler | |
| parent | 03b24f275607672fce4577a6a3edbb18d9b1977d (diff) | |
| download | rust-30588657b753b9ae500b3514d58da18a4a155b08.tar.gz rust-30588657b753b9ae500b3514d58da18a4a155b08.zip | |
avoid unnecessary nested conditionals
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs index a5e7cae6934..48a590f5d37 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs @@ -228,17 +228,15 @@ impl<'tcx> ConstToPat<'tcx> { } } } - } else if !self.saw_const_match_lint.get() { - if !have_valtree { - // The only way valtree construction can fail without the structural match - // checker finding a violation is if there is a pointer somewhere. - self.tcx().emit_spanned_lint( - lint::builtin::POINTER_STRUCTURAL_MATCH, - self.id, - self.span, - PointerPattern, - ); - } + } else if !have_valtree && !self.saw_const_match_lint.get() { + // The only way valtree construction can fail without the structural match + // checker finding a violation is if there is a pointer somewhere. + self.tcx().emit_spanned_lint( + lint::builtin::POINTER_STRUCTURAL_MATCH, + self.id, + self.span, + PointerPattern, + ); } // Always check for `PartialEq`, even if we emitted other lints. (But not if there were |
