Skip to content

Commit 52e7243

Browse files
committed
Move to MaybeIncorrect when binding values
1 parent 23e49af commit 52e7243

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clippy_lints/src/matches.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ declare_clippy_lint! {
285285
///
286286
/// **Why is this bad?** Readability and needless complexity.
287287
///
288-
/// **Known problems:** None.
288+
/// **Known problems:** Suggested replacements may be incorrect when `match`
289+
/// is actually binding temporary value, bringing a 'dropped while borrowed' error.
289290
///
290291
/// **Example:**
291292
/// ```rust
@@ -850,7 +851,7 @@ fn check_match_single_binding(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[A
850851
},
851852
}
852853

853-
let mut applicability = Applicability::MachineApplicable;
854+
let mut applicability = Applicability::MaybeIncorrect;
854855
match arms[0].pat.kind {
855856
PatKind::Binding(..) | PatKind::Tuple(_, _) | PatKind::Struct(..) => {
856857
span_lint_and_sugg(

0 commit comments

Comments
 (0)