Replace some _ == _ || _ == _
s with matches!(_, _ | _)
s
This commit is contained in:
parent
4d75f61832
commit
f1d273cbfb
7 changed files with 7 additions and 7 deletions
|
@ -754,7 +754,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
|
|||
// FIXME(JakobDegen) The validator should check that `self.mir_phase <
|
||||
// DropsLowered`. However, this causes ICEs with generation of drop shims, which
|
||||
// seem to fail to set their `MirPhase` correctly.
|
||||
if *kind == RetagKind::Raw || *kind == RetagKind::TwoPhase {
|
||||
if matches!(kind, RetagKind::Raw | RetagKind::TwoPhase) {
|
||||
self.fail(location, format!("explicit `{:?}` is forbidden", kind));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ impl StyledBuffer {
|
|||
pub fn set_style(&mut self, line: usize, col: usize, style: Style, overwrite: bool) {
|
||||
if let Some(ref mut line) = self.lines.get_mut(line) {
|
||||
if let Some(StyledChar { style: s, .. }) = line.get_mut(col) {
|
||||
if overwrite || *s == Style::NoStyle || *s == Style::Quotation {
|
||||
if overwrite || matches!(s, Style::NoStyle | Style::Quotation) {
|
||||
*s = style;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -503,7 +503,7 @@ impl TtParser {
|
|||
mp.push_match(metavar_idx, seq_depth, MatchedSeq(vec![]));
|
||||
}
|
||||
|
||||
if op == KleeneOp::ZeroOrMore || op == KleeneOp::ZeroOrOne {
|
||||
if matches!(op, KleeneOp::ZeroOrMore | KleeneOp::ZeroOrOne) {
|
||||
// Try zero matches of this sequence, by skipping over it.
|
||||
self.cur_mps.push(MatcherPos {
|
||||
idx: idx_first_after,
|
||||
|
|
|
@ -107,7 +107,7 @@ impl<'tcx> Collector<'tcx> {
|
|||
return;
|
||||
};
|
||||
|
||||
if abi == Abi::Rust || abi == Abi::RustIntrinsic || abi == Abi::PlatformIntrinsic {
|
||||
if matches!(abi, Abi::Rust | Abi::RustIntrinsic | Abi::PlatformIntrinsic) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -527,7 +527,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
|||
let r = self.use_ecx(|this| this.ecx.read_immediate(&this.ecx.eval_operand(right, None)?));
|
||||
let l = self.use_ecx(|this| this.ecx.read_immediate(&this.ecx.eval_operand(left, None)?));
|
||||
// Check for exceeding shifts *even if* we cannot evaluate the LHS.
|
||||
if op == BinOp::Shr || op == BinOp::Shl {
|
||||
if matches!(op, BinOp::Shr | BinOp::Shl) {
|
||||
let r = r.clone()?;
|
||||
// We need the type of the LHS. We cannot use `place_layout` as that is the type
|
||||
// of the result, which for checked binops is not the same!
|
||||
|
|
|
@ -368,7 +368,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
|||
this.ecx.read_immediate(&this.ecx.eval_operand(left, None)?)
|
||||
});
|
||||
// Check for exceeding shifts *even if* we cannot evaluate the LHS.
|
||||
if op == BinOp::Shr || op == BinOp::Shl {
|
||||
if matches!(op, BinOp::Shr | BinOp::Shl) {
|
||||
let r = r.clone()?;
|
||||
// We need the type of the LHS. We cannot use `place_layout` as that is the type
|
||||
// of the result, which for checked binops is not the same!
|
||||
|
|
|
@ -125,7 +125,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
|
|||
if let Some((depr, span)) = &depr {
|
||||
is_deprecated = true;
|
||||
|
||||
if kind == AnnotationKind::Prohibited || kind == AnnotationKind::DeprecationProhibited {
|
||||
if matches!(kind, AnnotationKind::Prohibited | AnnotationKind::DeprecationProhibited) {
|
||||
let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
self.tcx.emit_spanned_lint(
|
||||
USELESS_DEPRECATED,
|
||||
|
|
Loading…
Add table
Reference in a new issue