Skip to content

Commit 10313a2

Browse files
committed
Revert "Fix cases of match_wildcard_for_single_variants lint when it is spanned on Option"
This reverts commit 4948307.
1 parent 1c59cd5 commit 10313a2

File tree

7 files changed

+9
-13
lines changed

7 files changed

+9
-13
lines changed

clippy_lints/src/consts.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ impl Constant {
139139
.find(|r| r.map_or(true, |o| o != Ordering::Equal))
140140
.unwrap_or_else(|| Some(l.len().cmp(&r.len()))),
141141
(&Self::Repeat(ref lv, ref ls), &Self::Repeat(ref rv, ref rs)) => {
142-
#[allow(clippy::match_wildcard_for_single_variants)]
143142
match Self::partial_cmp(tcx, cmp_type, lv, rv) {
144143
Some(Equal) => Some(ls.cmp(rs)),
145144
x => x,
@@ -355,14 +354,14 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
355354
(Some(Constant::Vec(vec)), Some(Constant::Int(index))) => match vec.get(index as usize) {
356355
Some(Constant::F32(x)) => Some(Constant::F32(*x)),
357356
Some(Constant::F64(x)) => Some(Constant::F64(*x)),
358-
Some(_) | None => None,
357+
_ => None,
359358
},
360359
(Some(Constant::Vec(vec)), _) => {
361360
if !vec.is_empty() && vec.iter().all(|x| *x == vec[0]) {
362361
match vec.get(0) {
363362
Some(Constant::F32(x)) => Some(Constant::F32(*x)),
364363
Some(Constant::F64(x)) => Some(Constant::F64(*x)),
365-
Some(_) | None => None,
364+
_ => None,
366365
}
367366
} else {
368367
None
@@ -533,7 +532,7 @@ pub fn miri_to_const(result: &ty::Const<'_>) -> Option<Constant> {
533532
})
534533
.collect::<Option<Vec<Constant>>>()
535534
.map(Constant::Vec),
536-
Some(_) | None => None,
535+
_ => None,
537536
},
538537
ty::Float(FloatTy::F64) => match miri_to_const(len) {
539538
Some(Constant::Int(len)) => alloc
@@ -547,7 +546,7 @@ pub fn miri_to_const(result: &ty::Const<'_>) -> Option<Constant> {
547546
})
548547
.collect::<Option<Vec<Constant>>>()
549548
.map(Constant::Vec),
550-
Some(_) | None => None,
549+
_ => None,
551550
},
552551
// FIXME: implement other array type conversions.
553552
_ => None,

clippy_lints/src/escape.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxedLocal {
9595
fn is_argument(map: rustc_middle::hir::map::Map<'_>, id: HirId) -> bool {
9696
match map.find(id) {
9797
Some(Node::Binding(_)) => (),
98-
Some(_) | None => return false,
98+
_ => return false,
9999
}
100100

101101
match map.find(map.get_parent_node(id)) {
102102
Some(Node::Param(_)) => true,
103-
Some(_) | None => false,
103+
_ => false,
104104
}
105105
}
106106

clippy_lints/src/floating_point_arithmetic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ fn is_zero(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
410410
Some(Constant::Int(i)) => i == 0,
411411
Some(Constant::F32(f)) => f == 0.0,
412412
Some(Constant::F64(f)) => f == 0.0,
413-
Some(_) | None => false,
413+
_ => false,
414414
}
415415
}
416416

clippy_lints/src/loops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2154,7 +2154,7 @@ fn is_loop_nested(cx: &LateContext<'_, '_>, loop_expr: &Expr<'_>, iter_expr: &Ex
21542154
}
21552155
},
21562156
Some(Node::Stmt(_)) => (),
2157-
Some(_) | None => {
2157+
_ => {
21582158
return false;
21592159
},
21602160
}

clippy_lints/src/misc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ fn is_allowed<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) -> boo
509509
Constant::F64(f) => *f == 0.0 || (*f).is_infinite(),
510510
_ => false,
511511
}),
512-
Some(_) | None => false,
512+
_ => false,
513513
}
514514
}
515515

clippy_lints/src/modulo_arithmetic.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ struct OperandInfo {
3737
}
3838

3939
fn analyze_operand(operand: &Expr<'_>, cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> Option<OperandInfo> {
40-
#[allow(clippy::match_wildcard_for_single_variants)]
4140
match constant(cx, cx.tables, operand) {
4241
Some((Constant::Int(v), _)) => match cx.tables.expr_ty(expr).kind {
4342
ty::Int(ity) => {

clippy_lints/src/utils/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ pub fn trait_ref_of_method<'tcx>(cx: &LateContext<'_, 'tcx>, hir_id: HirId) -> O
370370

371371
/// Checks whether this type implements `Drop`.
372372
pub fn has_drop<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>) -> bool {
373-
#[allow(clippy::match_wildcard_for_single_variants)]
374373
match ty.ty_adt_def() {
375374
Some(def) => def.has_dtor(cx.tcx),
376375
_ => false,
@@ -445,7 +444,6 @@ pub fn is_entrypoint_fn(cx: &LateContext<'_, '_>, def_id: DefId) -> bool {
445444
/// Gets the name of the item the expression is in, if available.
446445
pub fn get_item_name(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> Option<Name> {
447446
let parent_id = cx.tcx.hir().get_parent_item(expr.hir_id);
448-
#[allow(clippy::match_wildcard_for_single_variants)]
449447
match cx.tcx.hir().find(parent_id) {
450448
Some(
451449
Node::Item(Item { ident, .. })

0 commit comments

Comments
 (0)