Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: allow `clippy::disallowed_names` for doctests

Examples (i.e. doctests) may want to use names such as `foo`, thus the
`clippy::disallowed_names` lint [1] gets in the way.

Thus allow it for all doctests.

In addition, remove it from the existing `expect`s we have in a few
doctests.

This does not mean that we should stop trying to find good names for
our examples, though.

Link: https://rust-lang.github.io/rust-clippy/stable/index.html#disallowed_names [1]
Suggested-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/rust-for-linux/aRHSLChi5HYXW4-9@google.com/
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Benno Lossin <lossin@kernel.org>
Link: https://patch.msgid.link/20251117080714.876978-1-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

+2 -4
+1 -2
rust/kernel/init.rs
··· 30 30 //! ## General Examples 31 31 //! 32 32 //! ```rust 33 - //! # #![expect(clippy::disallowed_names, clippy::undocumented_unsafe_blocks)] 33 + //! # #![expect(clippy::undocumented_unsafe_blocks)] 34 34 //! use kernel::types::Opaque; 35 35 //! use pin_init::pin_init_from_closure; 36 36 //! ··· 67 67 //! ``` 68 68 //! 69 69 //! ```rust 70 - //! # #![expect(clippy::disallowed_names)] 71 70 //! use kernel::{prelude::*, types::Opaque}; 72 71 //! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin}; 73 72 //! # mod bindings {
-1
rust/kernel/types.rs
··· 289 289 /// # Examples 290 290 /// 291 291 /// ``` 292 - /// # #![expect(clippy::disallowed_names)] 293 292 /// use kernel::types::Opaque; 294 293 /// # // Emulate a C struct binding which is from C, maybe uninitialized or not, only the C side 295 294 /// # // knows.
+1 -1
scripts/rustdoc_test_gen.rs
··· 208 208 #[allow(unused)] 209 209 static __DOCTEST_ANCHOR: i32 = ::core::line!() as i32 + {body_offset} + 1; 210 210 {{ 211 - #![allow(unreachable_pub)] 211 + #![allow(unreachable_pub, clippy::disallowed_names)] 212 212 {body} 213 213 main(); 214 214 }}