Skip to content

Commit 7b8598d

Browse files
committed
ptr lint: check_mut_from_ref is checked independently of the function's ABI
1 parent 30d06a8 commit 7b8598d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clippy_lints/src/ptr.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,13 @@ impl<'tcx> LateLintPass<'tcx> for Ptr {
163163
return;
164164
}
165165

166+
check_mut_from_ref(cx, sig, None);
167+
166168
if !matches!(sig.header.abi, Abi::Rust) {
167169
// Ignore `extern` functions with non-Rust calling conventions
168170
return;
169171
}
170172

171-
check_mut_from_ref(cx, sig, None);
172173
for arg in check_fn_args(
173174
cx,
174175
cx.tcx.fn_sig(item.owner_id).subst_identity().skip_binder().inputs(),
@@ -223,12 +224,13 @@ impl<'tcx> LateLintPass<'tcx> for Ptr {
223224
_ => return,
224225
};
225226

227+
check_mut_from_ref(cx, sig, Some(body));
228+
226229
if !matches!(sig.header.abi, Abi::Rust) {
227230
// Ignore `extern` functions with non-Rust calling conventions
228231
return;
229232
}
230233

231-
check_mut_from_ref(cx, sig, Some(body));
232234
let decl = sig.decl;
233235
let sig = cx.tcx.fn_sig(item_id).subst_identity().skip_binder();
234236
let lint_args: Vec<_> = check_fn_args(cx, sig.inputs(), decl.inputs, &decl.output, body.params)

0 commit comments

Comments
 (0)