[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250701053557.20859-3-work@onurozkan.dev>
Date: Tue, 1 Jul 2025 08:35:53 +0300
From: Onur Özkan <work@...rozkan.dev>
To: 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,
tmgross@...ch.edu,
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,
Onur Özkan <work@...rozkan.dev>
Subject: [PATCH v4 2/6] rust: switch to `#[expect(...)]` in init and kunit
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
Powered by blists - more mailing lists