summaryrefslogtreecommitdiff
path: root/rust/kernel
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2025-03-07 23:49:21 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-13 13:01:42 +0100
commit87052e24eb46815a9f89696fe4c520430fea409e (patch)
tree207d4333337692be8711b59c420730866c6947c0 /rust/kernel
parent9dd2e0358b03e1061c197bc1f6dec1a62a42975f (diff)
downloadlinux-87052e24eb46815a9f89696fe4c520430fea409e.tar.gz
linux-87052e24eb46815a9f89696fe4c520430fea409e.tar.bz2
linux-87052e24eb46815a9f89696fe4c520430fea409e.zip
rust: enable Clippy's `check-private-items`
commit 624063b9ac97f40cadca32a896aafeb28b1220fd upstream. In Rust 1.76.0, Clippy added the `check-private-items` lint configuration option. When turned on (the default is off), it makes several lints check private items as well. In our case, it affects two lints we have enabled [1]: `missing_safety_doc` and `unnecessary_safety_doc`. It also seems to affect the new `too_long_first_doc_paragraph` lint [2], even though the documentation does not mention it. Thus allow the few instances remaining we currently hit and enable the lint. Link: https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#check-private-items [1] Link: https://rust-lang.github.io/rust-clippy/master/index.html#/too_long_first_doc_paragraph [2] Reviewed-by: Trevor Gross <tmgross@umich.edu> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Tested-by: Gary Guo <gary@garyguo.net> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/20240904204347.168520-16-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'rust/kernel')
-rw-r--r--rust/kernel/init.rs1
-rw-r--r--rust/kernel/init/__internal.rs2
-rw-r--r--rust/kernel/init/macros.rs1
-rw-r--r--rust/kernel/print.rs1
4 files changed, 5 insertions, 0 deletions
diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
index 0330a8756fa5..fdbf0857ba20 100644
--- a/rust/kernel/init.rs
+++ b/rust/kernel/init.rs
@@ -125,6 +125,7 @@
//! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
//! # mod bindings {
//! # #![allow(non_camel_case_types)]
+//! # #![allow(clippy::missing_safety_doc)]
//! # pub struct foo;
//! # pub unsafe fn init_foo(_ptr: *mut foo) {}
//! # pub unsafe fn destroy_foo(_ptr: *mut foo) {}
diff --git a/rust/kernel/init/__internal.rs b/rust/kernel/init/__internal.rs
index 163eb072f296..549ae227c2ea 100644
--- a/rust/kernel/init/__internal.rs
+++ b/rust/kernel/init/__internal.rs
@@ -54,6 +54,7 @@ where
pub unsafe trait HasPinData {
type PinData: PinData;
+ #[allow(clippy::missing_safety_doc)]
unsafe fn __pin_data() -> Self::PinData;
}
@@ -83,6 +84,7 @@ pub unsafe trait PinData: Copy {
pub unsafe trait HasInitData {
type InitData: InitData;
+ #[allow(clippy::missing_safety_doc)]
unsafe fn __init_data() -> Self::InitData;
}
diff --git a/rust/kernel/init/macros.rs b/rust/kernel/init/macros.rs
index 736fe0ce0cd9..193d39886b1f 100644
--- a/rust/kernel/init/macros.rs
+++ b/rust/kernel/init/macros.rs
@@ -989,6 +989,7 @@ macro_rules! __pin_data {
//
// The functions are `unsafe` to prevent accidentally calling them.
#[allow(dead_code)]
+ #[allow(clippy::missing_safety_doc)]
impl<$($impl_generics)*> $pin_data<$($ty_generics)*>
where $($whr)*
{
diff --git a/rust/kernel/print.rs b/rust/kernel/print.rs
index fe53fc469c4f..45af17095a24 100644
--- a/rust/kernel/print.rs
+++ b/rust/kernel/print.rs
@@ -14,6 +14,7 @@ use core::{
use crate::str::RawFormatter;
// Called from `vsprintf` with format specifier `%pA`.
+#[allow(clippy::missing_safety_doc)]
#[no_mangle]
unsafe extern "C" fn rust_fmt_argument(
buf: *mut c_char,