From 1afeb399d9a5e14c069e03f71fde028a94fbd86d Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 25 Nov 2021 15:28:19 +0100 Subject: [PATCH 1/8] android: rust: use `pub(crate)` Signed-off-by: Miguel Ojeda --- drivers/android/allocation.rs | 4 ++-- drivers/android/defs.rs | 2 +- drivers/android/node.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/android/allocation.rs b/drivers/android/allocation.rs index 11656a171c98d9..5142bc11ab45ee 100644 --- a/drivers/android/allocation.rs +++ b/drivers/android/allocation.rs @@ -156,14 +156,14 @@ impl<'a, 'b> AllocationView<'a, 'b> { AllocationView { alloc, limit } } - pub fn read(&self, offset: usize) -> Result { + pub(crate) fn read(&self, offset: usize) -> Result { if offset.checked_add(size_of::()).ok_or(Error::EINVAL)? > self.limit { return Err(Error::EINVAL); } self.alloc.read(offset) } - pub fn write(&self, offset: usize, obj: &T) -> Result { + pub(crate) fn write(&self, offset: usize, obj: &T) -> Result { if offset.checked_add(size_of::()).ok_or(Error::EINVAL)? > self.limit { return Err(Error::EINVAL); } diff --git a/drivers/android/defs.rs b/drivers/android/defs.rs index 2fd0413637c43e..ec2dde9b3dd84c 100644 --- a/drivers/android/defs.rs +++ b/drivers/android/defs.rs @@ -9,7 +9,7 @@ use kernel::{ macro_rules! pub_no_prefix { ($prefix:ident, $($newname:ident),+) => { - $(pub const $newname: u32 = concat_idents!($prefix, $newname);)+ + $(pub(crate) const $newname: u32 = concat_idents!($prefix, $newname);)+ }; } diff --git a/drivers/android/node.rs b/drivers/android/node.rs index c57f8fe10ee236..fd0c80aba47659 100644 --- a/drivers/android/node.rs +++ b/drivers/android/node.rs @@ -395,7 +395,7 @@ impl DeliverToRead for Node { } } -pub struct NodeRef { +pub(crate) struct NodeRef { pub(crate) node: Ref, strong_count: usize, weak_count: usize, From a57745f587298d01ddc34f82ab523487ceae3ac7 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 25 Nov 2021 15:28:19 +0100 Subject: [PATCH 2/8] rust: macros: use `pub(crate)` Signed-off-by: Miguel Ojeda --- rust/macros/helpers.rs | 22 +++++++++++----------- rust/macros/module.rs | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rust/macros/helpers.rs b/rust/macros/helpers.rs index 5431f65fe16ffe..ad210563e5a6c1 100644 --- a/rust/macros/helpers.rs +++ b/rust/macros/helpers.rs @@ -2,7 +2,7 @@ use proc_macro::{token_stream, Group, TokenTree}; -pub fn try_ident(it: &mut token_stream::IntoIter) -> Option { +pub(crate) fn try_ident(it: &mut token_stream::IntoIter) -> Option { if let Some(TokenTree::Ident(ident)) = it.next() { Some(ident.to_string()) } else { @@ -10,7 +10,7 @@ pub fn try_ident(it: &mut token_stream::IntoIter) -> Option { } } -pub fn try_literal(it: &mut token_stream::IntoIter) -> Option { +pub(crate) fn try_literal(it: &mut token_stream::IntoIter) -> Option { if let Some(TokenTree::Literal(literal)) = it.next() { Some(literal.to_string()) } else { @@ -18,7 +18,7 @@ pub fn try_literal(it: &mut token_stream::IntoIter) -> Option { } } -pub fn try_byte_string(it: &mut token_stream::IntoIter) -> Option { +pub(crate) fn try_byte_string(it: &mut token_stream::IntoIter) -> Option { try_literal(it).and_then(|byte_string| { if byte_string.starts_with("b\"") && byte_string.ends_with('\"') { Some(byte_string[2..byte_string.len() - 1].to_string()) @@ -28,11 +28,11 @@ pub fn try_byte_string(it: &mut token_stream::IntoIter) -> Option { }) } -pub fn expect_ident(it: &mut token_stream::IntoIter) -> String { +pub(crate) fn expect_ident(it: &mut token_stream::IntoIter) -> String { try_ident(it).expect("Expected Ident") } -pub fn expect_punct(it: &mut token_stream::IntoIter) -> char { +pub(crate) fn expect_punct(it: &mut token_stream::IntoIter) -> char { if let TokenTree::Punct(punct) = it.next().expect("Reached end of token stream for Punct") { punct.as_char() } else { @@ -40,11 +40,11 @@ pub fn expect_punct(it: &mut token_stream::IntoIter) -> char { } } -pub fn expect_literal(it: &mut token_stream::IntoIter) -> String { +pub(crate) fn expect_literal(it: &mut token_stream::IntoIter) -> String { try_literal(it).expect("Expected Literal") } -pub fn expect_group(it: &mut token_stream::IntoIter) -> Group { +pub(crate) fn expect_group(it: &mut token_stream::IntoIter) -> Group { if let TokenTree::Group(group) = it.next().expect("Reached end of token stream for Group") { group } else { @@ -52,17 +52,17 @@ pub fn expect_group(it: &mut token_stream::IntoIter) -> Group { } } -pub fn expect_byte_string(it: &mut token_stream::IntoIter) -> String { +pub(crate) fn expect_byte_string(it: &mut token_stream::IntoIter) -> String { try_byte_string(it).expect("Expected byte string") } -pub fn expect_end(it: &mut token_stream::IntoIter) { +pub(crate) fn expect_end(it: &mut token_stream::IntoIter) { if it.next().is_some() { panic!("Expected end"); } } -pub fn get_literal(it: &mut token_stream::IntoIter, expected_name: &str) -> String { +pub(crate) fn get_literal(it: &mut token_stream::IntoIter, expected_name: &str) -> String { assert_eq!(expect_ident(it), expected_name); assert_eq!(expect_punct(it), ':'); let literal = expect_literal(it); @@ -70,7 +70,7 @@ pub fn get_literal(it: &mut token_stream::IntoIter, expected_name: &str) -> Stri literal } -pub fn get_byte_string(it: &mut token_stream::IntoIter, expected_name: &str) -> String { +pub(crate) fn get_byte_string(it: &mut token_stream::IntoIter, expected_name: &str) -> String { assert_eq!(expect_ident(it), expected_name); assert_eq!(expect_punct(it), ':'); let byte_string = expect_byte_string(it); diff --git a/rust/macros/module.rs b/rust/macros/module.rs index 64f54937c2cf25..c9cf9da7bbcbd4 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs @@ -303,7 +303,7 @@ impl ModuleInfo { } } -pub fn module(ts: TokenStream) -> TokenStream { +pub(crate) fn module(ts: TokenStream) -> TokenStream { let mut it = ts.into_iter(); let info = ModuleInfo::parse(&mut it); From ea35e062d93a8b81c2774ee0bce645a4e8e0949b Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 25 Nov 2021 15:28:19 +0100 Subject: [PATCH 3/8] rust: kernel: improve visibility Signed-off-by: Miguel Ojeda --- rust/kernel/allocator.rs | 12 +++++++----- rust/kernel/amba.rs | 4 ++-- rust/kernel/error.rs | 6 +++--- rust/kernel/file_operations.rs | 3 +-- rust/kernel/gpio.rs | 4 +++- rust/kernel/irq.rs | 2 +- rust/kernel/platdev.rs | 3 +-- rust/kernel/power.rs | 2 +- 8 files changed, 19 insertions(+), 17 deletions(-) diff --git a/rust/kernel/allocator.rs b/rust/kernel/allocator.rs index 759cec47de2b15..4c5d2fc6f206a0 100644 --- a/rust/kernel/allocator.rs +++ b/rust/kernel/allocator.rs @@ -8,7 +8,7 @@ use core::ptr; use crate::bindings; use crate::c_types; -pub struct KernelAllocator; +struct KernelAllocator; unsafe impl GlobalAlloc for KernelAllocator { unsafe fn alloc(&self, layout: Layout) -> *mut u8 { @@ -30,18 +30,20 @@ static ALLOCATOR: KernelAllocator = KernelAllocator; // `rustc` only generates these for some crate types. Even then, we would need // to extract the object file that has them from the archive. For the moment, // let's generate them ourselves instead. +// +// Note that `#[no_mangle]` implies exported too, nowadays. #[no_mangle] -pub fn __rust_alloc(size: usize, _align: usize) -> *mut u8 { +fn __rust_alloc(size: usize, _align: usize) -> *mut u8 { unsafe { bindings::krealloc(core::ptr::null(), size, bindings::GFP_KERNEL) as *mut u8 } } #[no_mangle] -pub fn __rust_dealloc(ptr: *mut u8, _size: usize, _align: usize) { +fn __rust_dealloc(ptr: *mut u8, _size: usize, _align: usize) { unsafe { bindings::kfree(ptr as *const c_types::c_void) }; } #[no_mangle] -pub fn __rust_realloc(ptr: *mut u8, _old_size: usize, _align: usize, new_size: usize) -> *mut u8 { +fn __rust_realloc(ptr: *mut u8, _old_size: usize, _align: usize, new_size: usize) -> *mut u8 { unsafe { bindings::krealloc( ptr as *const c_types::c_void, @@ -52,7 +54,7 @@ pub fn __rust_realloc(ptr: *mut u8, _old_size: usize, _align: usize, new_size: u } #[no_mangle] -pub fn __rust_alloc_zeroed(size: usize, _align: usize) -> *mut u8 { +fn __rust_alloc_zeroed(size: usize, _align: usize) -> *mut u8 { unsafe { bindings::krealloc( core::ptr::null(), diff --git a/rust/kernel/amba.rs b/rust/kernel/amba.rs index 95fd273e0a23ec..689528502ca5ae 100644 --- a/rust/kernel/amba.rs +++ b/rust/kernel/amba.rs @@ -5,8 +5,8 @@ //! C header: [`include/linux/amba/bus.h`](../../../../include/linux/amba/bus.h) use crate::{ - bindings, c_types, device, driver, from_kernel_result, io_mem::Resource, power, str::CStr, - to_result, types::PointerWrapper, Error, Result, + bindings, c_types, device, driver, error::from_kernel_result, io_mem::Resource, power, + str::CStr, to_result, types::PointerWrapper, Error, Result, }; use core::{marker::PhantomData, ops::Deref}; diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index 5455417c4632b9..18055e069d62c6 100644 --- a/rust/kernel/error.rs +++ b/rust/kernel/error.rs @@ -427,8 +427,7 @@ impl From for Error { // # Invariant: `-bindings::MAX_ERRNO` fits in an `i16`. crate::static_assert!(bindings::MAX_ERRNO <= -(i16::MIN as i32) as u32); -#[doc(hidden)] -pub fn from_kernel_result_helper(r: Result) -> T +pub(crate) fn from_kernel_result_helper(r: Result) -> T where T: From, { @@ -465,7 +464,6 @@ where /// } /// } /// ``` -#[macro_export] macro_rules! from_kernel_result { ($($tt:tt)*) => {{ $crate::error::from_kernel_result_helper((|| { @@ -474,6 +472,8 @@ macro_rules! from_kernel_result { }}; } +pub(crate) use from_kernel_result; + /// Transform a kernel "error pointer" to a normal pointer. /// /// Some kernel C API functions return an "error pointer" which optionally diff --git a/rust/kernel/file_operations.rs b/rust/kernel/file_operations.rs index 47ce9a0b8c68f7..a0ae134964ad24 100644 --- a/rust/kernel/file_operations.rs +++ b/rust/kernel/file_operations.rs @@ -11,9 +11,8 @@ use alloc::boxed::Box; use crate::{ bindings, c_types, - error::{Error, Result}, + error::{from_kernel_result, Error, Result}, file::{File, FileRef}, - from_kernel_result, io_buffer::{IoBufferReader, IoBufferWriter}, iov_iter::IovIter, sync::CondVar, diff --git a/rust/kernel/gpio.rs b/rust/kernel/gpio.rs index defef8f1643b0d..e9b8b8dcb75f13 100644 --- a/rust/kernel/gpio.rs +++ b/rust/kernel/gpio.rs @@ -4,7 +4,9 @@ //! //! C header: [`include/linux/gpio/driver.h`](../../../../include/linux/gpio/driver.h) -use crate::{bindings, c_types, device, from_kernel_result, types::PointerWrapper, Error, Result}; +use crate::{ + bindings, c_types, device, error::from_kernel_result, types::PointerWrapper, Error, Result, +}; use core::{ cell::UnsafeCell, marker::{PhantomData, PhantomPinned}, diff --git a/rust/kernel/irq.rs b/rust/kernel/irq.rs index 68dbb08e85d107..36cb3519b76796 100644 --- a/rust/kernel/irq.rs +++ b/rust/kernel/irq.rs @@ -9,7 +9,7 @@ #![allow(dead_code)] -use crate::{bindings, c_types, from_kernel_result, types::PointerWrapper, Error, Result}; +use crate::{bindings, c_types, error::from_kernel_result, types::PointerWrapper, Error, Result}; use core::ops::Deref; type IrqHwNumber = bindings::irq_hw_number_t; diff --git a/rust/kernel/platdev.rs b/rust/kernel/platdev.rs index d55adb01059af7..852607dfe7f8bb 100644 --- a/rust/kernel/platdev.rs +++ b/rust/kernel/platdev.rs @@ -8,8 +8,7 @@ use crate::{ bindings, c_types, - error::{Error, Result}, - from_kernel_result, + error::{from_kernel_result, Error, Result}, of::OfMatchTable, str::CStr, types::PointerWrapper, diff --git a/rust/kernel/power.rs b/rust/kernel/power.rs index 6c554741b16c41..e318b5d9f0c0cc 100644 --- a/rust/kernel/power.rs +++ b/rust/kernel/power.rs @@ -6,7 +6,7 @@ #![allow(dead_code)] -use crate::{bindings, c_types, from_kernel_result, types::PointerWrapper, Result}; +use crate::{bindings, c_types, error::from_kernel_result, types::PointerWrapper, Result}; use core::marker::PhantomData; /// Corresponds to the kernel's `struct dev_pm_ops`. From a79a7dfab6a5f2692cb65b86aac0ad9a66490505 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 25 Nov 2021 15:28:20 +0100 Subject: [PATCH 4/8] rust: deny `unreachable_pub` Signed-off-by: Miguel Ojeda --- Makefile | 2 +- rust/Makefile | 4 +++- rust/kernel/bindings.rs | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index af324691646c3b..40e200e90c6bce 100644 --- a/Makefile +++ b/Makefile @@ -538,7 +538,7 @@ KBUILD_RUSTFLAGS := --emit=dep-info,obj,metadata --edition=2021 \ -Cforce-unwind-tables=n -Ccodegen-units=1 \ -Zbinary_dep_depinfo=y -Zsymbol-mangling-version=v0 \ -Dunsafe_op_in_unsafe_fn -Drust_2018_idioms \ - -Wmissing_docs + -Dunreachable_pub -Wmissing_docs KBUILD_CLIPPYFLAGS := -Dclippy::correctness -Dclippy::style \ -Dclippy::complexity -Dclippy::perf -Dclippy::float_arithmetic KBUILD_AFLAGS_KERNEL := diff --git a/rust/Makefile b/rust/Makefile index 086e1ef914cc5a..4da4d741d877a8 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -303,7 +303,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L cmd_rustc_library = \ OBJTREE=$(abspath $(objtree)) \ $(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \ - $(rust_flags) $(rust_cross_flags) $(rustc_target_flags) \ + $(filter-out $(skip_flags),$(rust_flags) $(rust_cross_flags) $(rustc_target_flags)) \ --crate-type rlib --out-dir $(objtree)/rust/ -L $(objtree)/rust/ \ --crate-name $(patsubst %.o,%,$(notdir $@)) $<; \ mv $(objtree)/rust/$(patsubst %.o,%,$(notdir $@)).d $(depfile); \ @@ -324,6 +324,7 @@ $(objtree)/rust/compiler_builtins.o: $(srctree)/rust/compiler_builtins.rs \ $(call if_changed_dep,rustc_library) $(objtree)/rust/alloc.o: private skip_clippy = 1 +$(objtree)/rust/alloc.o: private skip_flags = -Dunreachable_pub $(objtree)/rust/alloc.o: private rustc_target_flags = $(alloc-cfgs) $(objtree)/rust/alloc.o: $(srctree)/rust/alloc/lib.rs \ $(objtree)/rust/compiler_builtins.o FORCE @@ -346,6 +347,7 @@ $(objtree)/rust/kernel.o: $(srctree)/rust/kernel/lib.rs $(objtree)/rust/alloc.o # Targets that need to expand twice .SECONDEXPANSION: $(objtree)/rust/core.o: private skip_clippy = 1 +$(objtree)/rust/core.o: private skip_flags = -Dunreachable_pub $(objtree)/rust/core.o: private rustc_target_flags = $(core-cfgs) $(objtree)/rust/core.o: $$(RUST_LIB_SRC)/core/src/lib.rs FORCE $(call if_changed_dep,rustc_library) diff --git a/rust/kernel/bindings.rs b/rust/kernel/bindings.rs index 08182f94765474..02678ca589c858 100644 --- a/rust/kernel/bindings.rs +++ b/rust/kernel/bindings.rs @@ -14,6 +14,7 @@ non_upper_case_globals, non_snake_case, improper_ctypes, + unreachable_pub, unsafe_op_in_unsafe_fn )] From 835f218e2a2e8e0b1c2ab322df33d9476603dc24 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 25 Nov 2021 16:45:14 +0100 Subject: [PATCH 5/8] rust: kernel: use unit struct instead of `()` Signed-off-by: Miguel Ojeda --- rust/kernel/sync/mutex.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rust/kernel/sync/mutex.rs b/rust/kernel/sync/mutex.rs index 7dd04ef12fda70..aaaf5bcb87b386 100644 --- a/rust/kernel/sync/mutex.rs +++ b/rust/kernel/sync/mutex.rs @@ -86,17 +86,20 @@ impl CreatableLock for Mutex { } } +pub struct EmptyGuardContext; + // SAFETY: The underlying kernel `struct mutex` object ensures mutual exclusion. unsafe impl Lock for Mutex { type Inner = T; - type GuardContext = (); + type GuardContext = EmptyGuardContext; - fn lock_noguard(&self) { + fn lock_noguard(&self) -> EmptyGuardContext { // SAFETY: `mutex` points to valid memory. unsafe { bindings::mutex_lock(self.mutex.get()) }; + EmptyGuardContext } - unsafe fn unlock(&self, _: &mut ()) { + unsafe fn unlock(&self, _: &mut EmptyGuardContext) { // SAFETY: The safety requirements of the function ensure that the mutex is owned by the // caller. unsafe { bindings::mutex_unlock(self.mutex.get()) }; From a9dddf17de9a5f68df796343ab85a358251b2a26 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 25 Nov 2021 16:46:19 +0100 Subject: [PATCH 6/8] rust: deny `let_unit_value` Signed-off-by: Miguel Ojeda --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 40e200e90c6bce..a72c112ff70c81 100644 --- a/Makefile +++ b/Makefile @@ -540,7 +540,8 @@ KBUILD_RUSTFLAGS := --emit=dep-info,obj,metadata --edition=2021 \ -Dunsafe_op_in_unsafe_fn -Drust_2018_idioms \ -Dunreachable_pub -Wmissing_docs KBUILD_CLIPPYFLAGS := -Dclippy::correctness -Dclippy::style \ - -Dclippy::complexity -Dclippy::perf -Dclippy::float_arithmetic + -Dclippy::complexity -Dclippy::perf -Dclippy::float_arithmetic \ + -Dclippy::let_unit_value KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := KBUILD_RUSTFLAGS_KERNEL := From 3ec354dfcae779ca032d388bfdc52bc936e07882 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 25 Nov 2021 16:47:08 +0100 Subject: [PATCH 7/8] rust: warn/deny several more lints -Dnon_ascii_idents -Drustdoc::missing_crate_level_docs -Dclippy::suspicious -Dclippy::mut_mut -Dclippy::needless_bitwise_bool -Dclippy::needless_continue -Wclippy::dbg_macro `dbg_macro` is left as a warning since developers may be using `CLIPPY=1` for normal development. We may want to change how the entire `CLIPPY=1` works, possibly moving to `W=` anyway and always enabling it. Signed-off-by: Miguel Ojeda --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a72c112ff70c81..c5b9595c7bc636 100644 --- a/Makefile +++ b/Makefile @@ -538,10 +538,13 @@ KBUILD_RUSTFLAGS := --emit=dep-info,obj,metadata --edition=2021 \ -Cforce-unwind-tables=n -Ccodegen-units=1 \ -Zbinary_dep_depinfo=y -Zsymbol-mangling-version=v0 \ -Dunsafe_op_in_unsafe_fn -Drust_2018_idioms \ - -Dunreachable_pub -Wmissing_docs -KBUILD_CLIPPYFLAGS := -Dclippy::correctness -Dclippy::style \ + -Dunreachable_pub -Dnon_ascii_idents \ + -Drustdoc::missing_crate_level_docs -Wmissing_docs +KBUILD_CLIPPYFLAGS := -Dclippy::correctness -Dclippy::style -Dclippy::suspicious \ -Dclippy::complexity -Dclippy::perf -Dclippy::float_arithmetic \ - -Dclippy::let_unit_value + -Dclippy::let_unit_value -Dclippy::mut_mut \ + -Dclippy::needless_bitwise_bool -Dclippy::needless_continue \ + -Wclippy::dbg_macro KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := KBUILD_RUSTFLAGS_KERNEL := From a8c7ecf3081d0d38385a5f70cc514770e214ae58 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 25 Nov 2021 20:32:22 +0100 Subject: [PATCH 8/8] rust: no need for distinct Clippy flags Each tool including `rustc` itself, ignores unknown flags if in a namespace like `rustdoc::` or `clippy::`, thus we can keep all of them in a single list. Furthermore, we already skip Clippy for `core` and `alloc`. Signed-off-by: Miguel Ojeda --- Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index c5b9595c7bc636..7ca815f3d278ed 100644 --- a/Makefile +++ b/Makefile @@ -539,12 +539,13 @@ KBUILD_RUSTFLAGS := --emit=dep-info,obj,metadata --edition=2021 \ -Zbinary_dep_depinfo=y -Zsymbol-mangling-version=v0 \ -Dunsafe_op_in_unsafe_fn -Drust_2018_idioms \ -Dunreachable_pub -Dnon_ascii_idents \ - -Drustdoc::missing_crate_level_docs -Wmissing_docs -KBUILD_CLIPPYFLAGS := -Dclippy::correctness -Dclippy::style -Dclippy::suspicious \ - -Dclippy::complexity -Dclippy::perf -Dclippy::float_arithmetic \ - -Dclippy::let_unit_value -Dclippy::mut_mut \ - -Dclippy::needless_bitwise_bool -Dclippy::needless_continue \ - -Wclippy::dbg_macro + -Wmissing_docs \ + -Drustdoc::missing_crate_level_docs \ + -Dclippy::correctness -Dclippy::style -Dclippy::suspicious \ + -Dclippy::complexity -Dclippy::perf -Dclippy::float_arithmetic \ + -Dclippy::let_unit_value -Dclippy::mut_mut \ + -Dclippy::needless_bitwise_bool -Dclippy::needless_continue \ + -Wclippy::dbg_macro KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := KBUILD_RUSTFLAGS_KERNEL := @@ -557,7 +558,7 @@ CLANG_FLAGS := ifeq ($(KBUILD_CLIPPY),1) RUSTC_OR_CLIPPY_QUIET := CLIPPY - RUSTC_OR_CLIPPY = $(CLIPPY_DRIVER) $(KBUILD_CLIPPYFLAGS) + RUSTC_OR_CLIPPY = $(CLIPPY_DRIVER) else RUSTC_OR_CLIPPY_QUIET := RUSTC RUSTC_OR_CLIPPY = $(RUSTC)