diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index 4534b2ab28a..d32e58c1af9 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -163,12 +163,13 @@ fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx TraitItem<'_> return; } + check_mut_from_ref(cx, sig, None); + if !matches!(sig.header.abi, Abi::Rust) { // Ignore `extern` functions with non-Rust calling conventions return; } - check_mut_from_ref(cx, sig, None); for arg in check_fn_args( cx, cx.tcx.fn_sig(item.owner_id).subst_identity().skip_binder().inputs(), @@ -223,12 +224,13 @@ fn check_body(&mut self, cx: &LateContext<'tcx>, body: &'tcx Body<'_>) { _ => return, }; + check_mut_from_ref(cx, sig, Some(body)); + if !matches!(sig.header.abi, Abi::Rust) { // Ignore `extern` functions with non-Rust calling conventions return; } - check_mut_from_ref(cx, sig, Some(body)); let decl = sig.decl; let sig = cx.tcx.fn_sig(item_id).subst_identity().skip_binder(); let lint_args: Vec<_> = check_fn_args(cx, sig.inputs(), decl.inputs, &decl.output, body.params)