[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DB76CVMK4V80.NWOL1Z2SKS8Q@umich.edu>
Date: Tue, 08 Jul 2025 21:39:08 -0500
From: "Trevor Gross" <tmgross@...ch.edu>
To: Onur Özkan <work@...rozkan.dev>,
<rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-pm@...r.kernel.org>, <linux-kselftest@...r.kernel.org>,
<kunit-dev@...glegroups.com>
Cc: <airlied@...il.com>, <simona@...ll.ch>, <ojeda@...nel.org>,
<alex.gaynor@...il.com>, <boqun.feng@...il.com>, <gary@...yguo.net>,
<bjorn3_gh@...tonmail.com>, <lossin@...nel.org>, <a.hindborg@...nel.org>,
<aliceryhl@...gle.com>, <rafael@...nel.org>, <viresh.kumar@...aro.org>,
<gregkh@...uxfoundation.org>, <maarten.lankhorst@...ux.intel.com>,
<mripard@...nel.org>, <tzimmermann@...e.de>, <davidgow@...gle.com>,
<nm@...com>
Subject: Re: [PATCH v4 2/6] rust: switch to `#[expect(...)]` in init and
kunit
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 <work@...rozkan.dev>
> ---
> 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 <tmgross@...ch.edu>
Powered by blists - more mailing lists