Skip to content

Commit 39164ac

Browse files
committed
Fix flipped variable that made it through
1 parent 23b1699 commit 39164ac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

clippy_lints/src/matches/match_single_binding.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub(crate) fn check<'a>(cx: &LateContext<'a>, ex: &Expr<'a>, arms: &[Arm<'_>], e
5858
&snippet_body,
5959
&mut applicability,
6060
Some(span),
61-
false,
61+
true,
6262
);
6363

6464
span_lint_and_sugg(
@@ -91,7 +91,7 @@ pub(crate) fn check<'a>(cx: &LateContext<'a>, ex: &Expr<'a>, arms: &[Arm<'_>], e
9191
&snippet_body,
9292
&mut applicability,
9393
None,
94-
false,
94+
true,
9595
);
9696
(expr.span, sugg)
9797
},
@@ -116,7 +116,7 @@ pub(crate) fn check<'a>(cx: &LateContext<'a>, ex: &Expr<'a>, arms: &[Arm<'_>], e
116116
&snippet_body,
117117
&mut applicability,
118118
None,
119-
true,
119+
false,
120120
);
121121

122122
span_lint_and_sugg(
@@ -208,13 +208,13 @@ fn sugg_with_curlies<'a>(
208208
});
209209

210210
let scrutinee = if needs_var_binding {
211-
snippet_with_applicability(cx, matched_vars, "..", applicability).to_string()
212-
} else {
213211
format!(
214212
"let {} = {}",
215213
snippet_with_applicability(cx, bind_names, "..", applicability),
216214
snippet_with_applicability(cx, matched_vars, "..", applicability)
217215
)
216+
} else {
217+
snippet_with_applicability(cx, matched_vars, "..", applicability).to_string()
218218
};
219219

220220
format!("{cbrace_start}{scrutinee};\n{indent}{assignment_str}{snippet_body}{cbrace_end}")

0 commit comments

Comments
 (0)