diff options
| author | Milo Moisson <milomoisson@gmail.com> | 2023-07-24 01:23:35 +0200 |
|---|---|---|
| committer | Milo Moisson <milomoisson@gmail.com> | 2023-07-24 01:23:35 +0200 |
| commit | 7b8598d6c0c28c4e60387f18fae8d5b021ce5907 (patch) | |
| tree | 1bfd8460cd3e06ba7cfb80816a4c0cbb71e216cf | |
| parent | 30d06a810c8b8967d9d0ea2cb64d5adf8b357914 (diff) | |
| download | rust-7b8598d6c0c28c4e60387f18fae8d5b021ce5907.tar.gz rust-7b8598d6c0c28c4e60387f18fae8d5b021ce5907.zip | |
ptr lint: check_mut_from_ref is checked independently of the function's ABI
| -rw-r--r-- | clippy_lints/src/ptr.rs | 6 |
1 files changed, 4 insertions, 2 deletions
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 @@ impl<'tcx> LateLintPass<'tcx> for Ptr { 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 @@ impl<'tcx> LateLintPass<'tcx> for Ptr { _ => 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) |
