Skip to content

Commit 50ff06a

Browse files
committed
Fix sync fallout
1 parent 883599f commit 50ff06a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

clippy_lints/src/dereference.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Dereferencing {
7373
fn lint_deref(cx: &LateContext<'_, '_>, method_name: &str, call_expr: &Expr<'_>, var_span: Span, expr_span: Span) {
7474
match method_name {
7575
"deref" => {
76-
if cx.tcx.lang_items().deref_trait().map_or(false, |id| {
76+
let impl_deref_trait = cx.tcx.lang_items().deref_trait().map_or(false, |id| {
7777
implements_trait(cx, cx.tables().expr_ty(&call_expr), id, &[])
78-
}) {
78+
});
79+
if impl_deref_trait {
7980
span_lint_and_sugg(
8081
cx,
8182
EXPLICIT_DEREF_METHODS,
@@ -88,9 +89,10 @@ fn lint_deref(cx: &LateContext<'_, '_>, method_name: &str, call_expr: &Expr<'_>,
8889
}
8990
},
9091
"deref_mut" => {
91-
if cx.tcx.lang_items().deref_mut_trait().map_or(false, |id| {
92+
let impl_deref_mut_trait = cx.tcx.lang_items().deref_mut_trait().map_or(false, |id| {
9293
implements_trait(cx, cx.tables().expr_ty(&call_expr), id, &[])
93-
}) {
94+
});
95+
if impl_deref_mut_trait {
9496
span_lint_and_sugg(
9597
cx,
9698
EXPLICIT_DEREF_METHODS,

0 commit comments

Comments
 (0)