Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rust: enable
no_mangle_with_rust_abi
Clippy lint
Introduced in Rust 1.69.0 [1], this lint prevents forgetting to set the C ABI when using `#[no_mangle]` (or thinking it is implied). For instance, it would have prevented the issue [2] fixed by commit c682e4c ("rust: kernel: Mark rust_fmt_argument as extern "C""). error: `#[no_mangle]` set on a function with the default (`Rust`) ABI --> rust/kernel/print.rs:21:1 | 21 | / unsafe fn rust_fmt_argument( 22 | | buf: *mut c_char, 23 | | end: *mut c_char, 24 | | ptr: *const c_void, 25 | | ) -> *mut c_char { | |________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#no_mangle_with_rust_abi = note: requested on the command line with `-D clippy::no-mangle-with-rust-abi` help: set an ABI | 21 | unsafe extern "C" fn rust_fmt_argument( | ++++++++++ help: or explicitly set the default | 21 | unsafe extern "Rust" fn rust_fmt_argument( | +++++++++++++ Thus enable it. In some cases, we need to use the Rust ABI even with `#[no_mangle]`, and for that, one may use `extern "Rust"` explicitly, but `rustfmt` overwrites it (and there does not seem to be an option to prevent that: `force_explicit_abi` does not allow to control that part, and even if it did, or if there was another option, we may not use it, since so far we have been using the defaults). Therefore, use `allow`s instead for the few cases we had. Link: rust-lang/rust-clippy#10347 [1] Link: #967 [2] Link: https://rust-lang.github.io/rustfmt/?version=v1.5.2&search=force_explicit_abi#force_explicit_abi [3] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
- Loading branch information