mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-24 04:46:58 +00:00
Fix flipped variable that made it through
This commit is contained in:
parent
23b16998c3
commit
39164acf6e
@ -58,7 +58,7 @@ pub(crate) fn check<'a>(cx: &LateContext<'a>, ex: &Expr<'a>, arms: &[Arm<'_>], e
|
|||||||
&snippet_body,
|
&snippet_body,
|
||||||
&mut applicability,
|
&mut applicability,
|
||||||
Some(span),
|
Some(span),
|
||||||
false,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
span_lint_and_sugg(
|
span_lint_and_sugg(
|
||||||
@ -91,7 +91,7 @@ pub(crate) fn check<'a>(cx: &LateContext<'a>, ex: &Expr<'a>, arms: &[Arm<'_>], e
|
|||||||
&snippet_body,
|
&snippet_body,
|
||||||
&mut applicability,
|
&mut applicability,
|
||||||
None,
|
None,
|
||||||
false,
|
true,
|
||||||
);
|
);
|
||||||
(expr.span, sugg)
|
(expr.span, sugg)
|
||||||
},
|
},
|
||||||
@ -116,7 +116,7 @@ pub(crate) fn check<'a>(cx: &LateContext<'a>, ex: &Expr<'a>, arms: &[Arm<'_>], e
|
|||||||
&snippet_body,
|
&snippet_body,
|
||||||
&mut applicability,
|
&mut applicability,
|
||||||
None,
|
None,
|
||||||
true,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
span_lint_and_sugg(
|
span_lint_and_sugg(
|
||||||
@ -208,13 +208,13 @@ fn sugg_with_curlies<'a>(
|
|||||||
});
|
});
|
||||||
|
|
||||||
let scrutinee = if needs_var_binding {
|
let scrutinee = if needs_var_binding {
|
||||||
snippet_with_applicability(cx, matched_vars, "..", applicability).to_string()
|
|
||||||
} else {
|
|
||||||
format!(
|
format!(
|
||||||
"let {} = {}",
|
"let {} = {}",
|
||||||
snippet_with_applicability(cx, bind_names, "..", applicability),
|
snippet_with_applicability(cx, bind_names, "..", applicability),
|
||||||
snippet_with_applicability(cx, matched_vars, "..", applicability)
|
snippet_with_applicability(cx, matched_vars, "..", applicability)
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
snippet_with_applicability(cx, matched_vars, "..", applicability).to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
format!("{cbrace_start}{scrutinee};\n{indent}{assignment_str}{snippet_body}{cbrace_end}")
|
format!("{cbrace_start}{scrutinee};\n{indent}{assignment_str}{snippet_body}{cbrace_end}")
|
||||||
|
Loading…
Reference in New Issue
Block a user