diff --git a/clippy_lints/src/redundant_pattern_matching.rs b/clippy_lints/src/redundant_pattern_matching.rs index ce33ebf87ba6..68862f838cb0 100644 --- a/clippy_lints/src/redundant_pattern_matching.rs +++ b/clippy_lints/src/redundant_pattern_matching.rs @@ -90,8 +90,8 @@ fn find_sugg_for_if_let<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, db.span_suggestion( span, "try this", - format!("if {}.{}", snippet(cx, op.span, "_"), good_method), - Applicability::MachineApplicable, // snippet + format!("{}.{}", snippet(cx, op.span, "_"), good_method), + Applicability::MaybeIncorrect, // snippet ); }, ); @@ -154,7 +154,7 @@ fn find_sugg_for_match<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, o span, "try this", format!("{}.{}", snippet(cx, op.span, "_"), good_method), - Applicability::MachineApplicable, // snippet + Applicability::MaybeIncorrect, // snippet ); }, ); diff --git a/tests/ui/redundant_pattern_matching.stderr b/tests/ui/redundant_pattern_matching.stderr index baed95d6f2e7..a904c5ceb9d5 100644 --- a/tests/ui/redundant_pattern_matching.stderr +++ b/tests/ui/redundant_pattern_matching.stderr @@ -2,7 +2,7 @@ error: redundant pattern matching, consider using `is_ok()` --> $DIR/redundant_pattern_matching.rs:5:12 | LL | if let Ok(_) = Ok::(42) {} - | -------^^^^^------------------------ help: try this: `if Ok::(42).is_ok()` + | -------^^^^^------------------------ help: try this: `Ok::(42).is_ok()` | = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` @@ -10,19 +10,19 @@ error: redundant pattern matching, consider using `is_err()` --> $DIR/redundant_pattern_matching.rs:7:12 | LL | if let Err(_) = Err::(42) {} - | -------^^^^^^------------------------- help: try this: `if Err::(42).is_err()` + | -------^^^^^^------------------------- help: try this: `Err::(42).is_err()` error: redundant pattern matching, consider using `is_none()` --> $DIR/redundant_pattern_matching.rs:9:12 | LL | if let None = None::<()> {} - | -------^^^^---------------- help: try this: `if None::<()>.is_none()` + | -------^^^^---------------- help: try this: `None::<()>.is_none()` error: redundant pattern matching, consider using `is_some()` --> $DIR/redundant_pattern_matching.rs:11:12 | LL | if let Some(_) = Some(42) {} - | -------^^^^^^^-------------- help: try this: `if Some(42).is_some()` + | -------^^^^^^^-------------- help: try this: `Some(42).is_some()` error: redundant pattern matching, consider using `is_ok()` --> $DIR/redundant_pattern_matching.rs:25:5