On Tue Jul 1, 2025 at 12:35 AM CDT, Onur Özkan wrote:
> This makes it clear that the warning is expected not just
> ignored, so we don't end up having various unnecessary
> linting rules in the codebase.
>
> Some parts of the codebase already use this approach, this
> patch just applies it more broadly.
>
> No functional changes.
>
> Signed-off-by: Onur Özkan <[email protected]>
> ---
>  rust/kernel/init.rs  | 6 +++---
>  rust/kernel/kunit.rs | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
> index 8d228c237954..288b1c2a290d 100644
> --- a/rust/kernel/init.rs
> +++ b/rust/kernel/init.rs
> @@ -30,7 +30,7 @@
>  //! ## General Examples
>  //!
>  //! ```rust,ignore
> -//! # #![allow(clippy::disallowed_names)]
> +//! # #![expect(clippy::disallowed_names)]
>  //! use kernel::types::Opaque;
>  //! use pin_init::pin_init_from_closure;
>  //!
> @@ -67,11 +67,11 @@
>  //! ```
>  //!
>  //! ```rust,ignore
> -//! # #![allow(unreachable_pub, clippy::disallowed_names)]
> +//! # #![expect(unreachable_pub, clippy::disallowed_names)]
>  //! use kernel::{prelude::*, types::Opaque};
>  //! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
>  //! # mod bindings {
> -//! #     #![allow(non_camel_case_types)]
> +//! #     #![expect(non_camel_case_types)]
>  //! #     pub struct foo;
>  //! #     pub unsafe fn init_foo(_ptr: *mut foo) {}
>  //! #     pub unsafe fn destroy_foo(_ptr: *mut foo) {}
> diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
> index 4b8cdcb21e77..91710a1d7b87 100644
> --- a/rust/kernel/kunit.rs
> +++ b/rust/kernel/kunit.rs
> @@ -280,7 +280,7 @@ macro_rules! kunit_unsafe_test_suite {
>              static mut KUNIT_TEST_SUITE: ::kernel::bindings::kunit_suite =
>                  ::kernel::bindings::kunit_suite {
>                      name: KUNIT_TEST_SUITE_NAME,
> -                    #[allow(unused_unsafe)]
> +                    #[expect(unused_unsafe)]
>                      // SAFETY: `$test_cases` is passed in by the user, and
>                      // (as documented) must be valid for the lifetime of
>                      // the suite (i.e., static).
> --
> 2.50.0

Understood that the files may wind up split here, but the changes look
good to me.

Reviewed-by: Trevor Gross <[email protected]>

Reply via email to