Skip to content

Commit 4a2ae88

Browse files
Nell Shamrell-Harringtonojeda
authored andcommitted
rust: remove unneeded kernel::prelude imports from doctests
Rust doctests implicitly include `kernel::prelude::*`. Removes explicit `kernel::prelude` imports from doctests. Suggested-by: Miguel Ojeda <ojeda@kernel.org> Link: Rust-for-Linux#1064 Signed-off-by: Nell Shamrell-Harrington <nells@linux.microsoft.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Link: https://lore.kernel.org/r/20240411225331.274662-1-nells@linux.microsoft.com [ Add it back for `module_phy_driver`'s example since it is within a `mod`, and thus it cannot be removed. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent ea175b2 commit 4a2ae88

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

rust/kernel/init.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
//!
8989
//! ```rust
9090
//! # #![allow(clippy::disallowed_names)]
91-
//! # use kernel::{sync::Mutex, prelude::*, new_mutex, init::PinInit, try_pin_init};
91+
//! # use kernel::{sync::Mutex, new_mutex, init::PinInit, try_pin_init};
9292
//! #[pin_data]
9393
//! struct DriverData {
9494
//! #[pin]
@@ -122,7 +122,7 @@
122122
//!
123123
//! ```rust
124124
//! # #![allow(unreachable_pub, clippy::disallowed_names)]
125-
//! use kernel::{prelude::*, init, types::Opaque};
125+
//! use kernel::{init, types::Opaque};
126126
//! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
127127
//! # mod bindings {
128128
//! # #![allow(non_camel_case_types)]
@@ -413,7 +413,7 @@ macro_rules! stack_try_pin_init {
413413
///
414414
/// ```rust
415415
/// # #![allow(clippy::disallowed_names)]
416-
/// # use kernel::{init, pin_init, prelude::*, init::*};
416+
/// # use kernel::{init, pin_init, init::*};
417417
/// # use core::pin::Pin;
418418
/// # #[pin_data]
419419
/// # struct Foo {

rust/kernel/workqueue.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
//! we do not need to specify ids for the fields.
3434
//!
3535
//! ```
36-
//! use kernel::prelude::*;
3736
//! use kernel::sync::Arc;
3837
//! use kernel::workqueue::{self, impl_has_work, new_work, Work, WorkItem};
3938
//!
@@ -75,7 +74,6 @@
7574
//! The following example shows how multiple `work_struct` fields can be used:
7675
//!
7776
//! ```
78-
//! use kernel::prelude::*;
7977
//! use kernel::sync::Arc;
8078
//! use kernel::workqueue::{self, impl_has_work, new_work, Work, WorkItem};
8179
//!
@@ -415,7 +413,6 @@ impl<T: ?Sized, const ID: u64> Work<T, ID> {
415413
/// like this:
416414
///
417415
/// ```no_run
418-
/// use kernel::prelude::*;
419416
/// use kernel::workqueue::{impl_has_work, Work};
420417
///
421418
/// struct MyWorkItem {

0 commit comments

Comments
 (0)