]> git.lizzy.rs Git - rust.git/commitdiff
Fix style in `if let` chain
authorEvan Typanski <evantypanski@gmail.com>
Fri, 30 Sep 2022 15:36:55 +0000 (11:36 -0400)
committerGitHub <noreply@github.com>
Fri, 30 Sep 2022 15:36:55 +0000 (11:36 -0400)
Co-authored-by: Alex Macleod <alex@macleod.io>
clippy_lints/src/eta_reduction.rs

index a5c6512a5e7d2760519cdcb0f56986c2e54b2ccf..3732410e71e57a9338ef71b6ab3a9e3f562c3789 100644 (file)
@@ -122,9 +122,10 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
             then {
                 span_lint_and_then(cx, REDUNDANT_CLOSURE, expr.span, "redundant closure", |diag| {
                     if let Some(mut snippet) = snippet_opt(cx, callee.span) {
-                        if let Some(fn_mut_id) = cx.tcx.lang_items().fn_mut_trait() &&
-                            implements_trait(cx, callee_ty.peel_refs(), fn_mut_id, &[]) &&
-                            path_to_local(callee).map_or(false, |l| local_used_after_expr(cx, l, expr)) {
+                        if let Some(fn_mut_id) = cx.tcx.lang_items().fn_mut_trait()
+                            && implements_trait(cx, callee_ty.peel_refs(), fn_mut_id, &[])
+                            && path_to_local(callee).map_or(false, |l| local_used_after_expr(cx, l, expr))
+                        {
                                 // Mutable closure is used after current expr; we cannot consume it.
                                 snippet = format!("&mut {snippet}");
                         }