Skip to content

Commit 85b8ff7

Browse files
Fix style in if let chain
Co-authored-by: Alex Macleod <alex@macleod.io>
1 parent 416da12 commit 85b8ff7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clippy_lints/src/eta_reduction.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
122122
then {
123123
span_lint_and_then(cx, REDUNDANT_CLOSURE, expr.span, "redundant closure", |diag| {
124124
if let Some(mut snippet) = snippet_opt(cx, callee.span) {
125-
if let Some(fn_mut_id) = cx.tcx.lang_items().fn_mut_trait() &&
126-
implements_trait(cx, callee_ty.peel_refs(), fn_mut_id, &[]) &&
127-
path_to_local(callee).map_or(false, |l| local_used_after_expr(cx, l, expr)) {
125+
if let Some(fn_mut_id) = cx.tcx.lang_items().fn_mut_trait()
126+
&& implements_trait(cx, callee_ty.peel_refs(), fn_mut_id, &[])
127+
&& path_to_local(callee).map_or(false, |l| local_used_after_expr(cx, l, expr))
128+
{
128129
// Mutable closure is used after current expr; we cannot consume it.
129130
snippet = format!("&mut {snippet}");
130131
}

0 commit comments

Comments
 (0)