diff --git a/Makefile b/Makefile index 8ab454529f064c..e27f2e96d9a6a6 100644 --- a/Makefile +++ b/Makefile @@ -526,7 +526,10 @@ KBUILD_RUSTCFLAGS := --emit=dep-info,obj,metadata --edition=2018 \ -Cpanic=abort -Cembed-bitcode=n -Clto=n -Crpath=n \ -Cforce-unwind-tables=n -Ccodegen-units=1 \ -Zbinary_dep_depinfo=y -Zsymbol-mangling-version=v0 \ - -Dunsafe_op_in_unsafe_fn -Wmissing_docs + -Dunsafe_op_in_unsafe_fn -Drust_2018_idioms \ + -Wmissing_docs +KBUILD_CLIPPYFLAGS := -Dclippy::correctness -Dclippy::style \ + -Dclippy::complexity -Dclippy::perf KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := KBUILD_RUSTCFLAGS_KERNEL := @@ -539,7 +542,7 @@ CLANG_FLAGS := ifeq ($(KBUILD_CLIPPY),1) RUSTC_OR_CLIPPY_QUIET := CLIPPY - RUSTC_OR_CLIPPY = $(CLIPPY_DRIVER) + RUSTC_OR_CLIPPY = $(CLIPPY_DRIVER) $(KBUILD_CLIPPYFLAGS) else RUSTC_OR_CLIPPY_QUIET := RUSTC RUSTC_OR_CLIPPY = $(RUSTC) diff --git a/drivers/android/node.rs b/drivers/android/node.rs index 8837b27dc7ee4e..c44c1e67e689df 100644 --- a/drivers/android/node.rs +++ b/drivers/android/node.rs @@ -320,7 +320,7 @@ impl Node { ) { out.ptr = self.ptr as _; out.cookie = self.cookie as _; - let inner = self.inner.access(&guard); + let inner = self.inner.access(guard); if inner.strong.has_count { out.has_strong_ref = 1; } diff --git a/drivers/android/rust_binder.rs b/drivers/android/rust_binder.rs index 8f457913154afe..c39c081af574de 100644 --- a/drivers/android/rust_binder.rs +++ b/drivers/android/rust_binder.rs @@ -6,6 +6,8 @@ #![no_std] #![feature(global_asm, try_reserve, allocator_api, concat_idents)] +// TODO: clean these up +#![allow(rust_2018_idioms)] use alloc::{boxed::Box, sync::Arc}; use core::pin::Pin; diff --git a/drivers/char/hw_random/bcm2835_rng_rust.rs b/drivers/char/hw_random/bcm2835_rng_rust.rs index 5f3ec20b295b8f..f3c0680011d355 100644 --- a/drivers/char/hw_random/bcm2835_rng_rust.rs +++ b/drivers/char/hw_random/bcm2835_rng_rust.rs @@ -73,7 +73,7 @@ struct RngModule { impl KernelModule for RngModule { fn init() -> Result<Self> { const OF_MATCH_TBL: ConstOfMatchTable<1> = - ConstOfMatchTable::new_const([&c_str!("brcm,bcm2835-rng")]); + ConstOfMatchTable::new_const([c_str!("brcm,bcm2835-rng")]); let pdev = platdev::Registration::new_pinned::<RngDriver>( c_str!("bcm2835-rng-rust"), diff --git a/rust/compiler_builtins.rs b/rust/compiler_builtins.rs index d8261c56984097..cb4bbf7be4e313 100644 --- a/rust/compiler_builtins.rs +++ b/rust/compiler_builtins.rs @@ -23,10 +23,6 @@ #![compiler_builtins] #![no_builtins] #![no_std] -#![deny(clippy::complexity)] -#![deny(clippy::correctness)] -#![deny(clippy::perf)] -#![deny(clippy::style)] macro_rules! define_panicking_intrinsics( ($reason: tt, { $($ident: ident, )* }) => { @@ -143,7 +139,7 @@ extern "C" { } #[panic_handler] -fn panic(_info: &core::panic::PanicInfo) -> ! { +fn panic(_info: &core::panic::PanicInfo<'_>) -> ! { unsafe { rust_helper_BUG(); } diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index dd7479c35e3e22..86c580fd7f68e8 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -24,11 +24,6 @@ receiver_trait, try_reserve )] -#![deny(clippy::complexity)] -#![deny(clippy::correctness)] -#![deny(clippy::perf)] -#![deny(clippy::style)] -#![deny(rust_2018_idioms)] // Ensure conditional compilation based on the kernel configuration works; // otherwise we may silently break things like initcall handling. diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs index fe39e5995f3600..cb7a4f12f3b4dc 100644 --- a/rust/macros/lib.rs +++ b/rust/macros/lib.rs @@ -2,11 +2,6 @@ //! Crate for all kernel procedural macros. -#![deny(clippy::complexity)] -#![deny(clippy::correctness)] -#![deny(clippy::perf)] -#![deny(clippy::style)] - mod module; use proc_macro::TokenStream;