mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
avoid unnecessary nested conditionals
This commit is contained in:
parent
03b24f2756
commit
30588657b7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user