]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/dereference.rs
Rollup merge of #101266 - LuisCardosoOliveira:translation-rustcsession-pt3, r=davidtwco
[rust.git] / src / tools / clippy / clippy_lints / src / dereference.rs
index d1ab7fb67962ea83c19d93360024b334b704cbaf..88e28018e5d00529f0f1a63da92e29075aec75cc 100644 (file)
@@ -830,25 +830,22 @@ fn walk_parents<'tcx>(
                             )
                         {
                             return Some(Position::MethodReceiverRefImpl)
-                        } else {
-                            return Some(Position::MethodReceiver)
                         }
+                        return Some(Position::MethodReceiver);
                     }
-                    args.iter()
-                        .position(|arg| arg.hir_id == child_id)
-                        .map(|i| {
-                            let ty = cx.tcx.fn_sig(id).skip_binder().inputs()[i + 1];
-                            if let ty::Param(param_ty) = ty.kind() {
-                                needless_borrow_impl_arg_position(cx, parent, i + 1, *param_ty, e, precedence, msrv)
-                            } else {
-                                ty_auto_deref_stability(
-                                    cx,
-                                    cx.tcx.erase_late_bound_regions(cx.tcx.fn_sig(id).input(i + 1)),
-                                    precedence,
-                                )
-                                .position_for_arg()
-                            }
-                        })
+                    args.iter().position(|arg| arg.hir_id == child_id).map(|i| {
+                        let ty = cx.tcx.fn_sig(id).skip_binder().inputs()[i + 1];
+                        if let ty::Param(param_ty) = ty.kind() {
+                            needless_borrow_impl_arg_position(cx, parent, i + 1, *param_ty, e, precedence, msrv)
+                        } else {
+                            ty_auto_deref_stability(
+                                cx,
+                                cx.tcx.erase_late_bound_regions(cx.tcx.fn_sig(id).input(i + 1)),
+                                precedence,
+                            )
+                            .position_for_arg()
+                        }
+                    })
                 },
                 ExprKind::Field(child, name) if child.hir_id == e.hir_id => Some(Position::FieldAccess(name.name)),
                 ExprKind::Unary(UnOp::Deref, child) if child.hir_id == e.hir_id => Some(Position::Deref),