Skip to content

Commit

Permalink
rust: remove unneeded kernel::prelude imports from doctests
Browse files Browse the repository at this point in the history
Rust doctests implicitly include `kernel::prelude::*`.

Removes explicit `kernel::prelude` imports from doctests.

Suggested-by: Miguel Ojeda <[email protected]>
Link: Rust-for-Linux#1064
Signed-off-by: Nell Shamrell-Harrington <[email protected]>
Reviewed-by: Benno Lossin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ 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 <[email protected]>
  • Loading branch information
Nell Shamrell-Harrington authored and ojeda committed May 5, 2024
1 parent ea175b2 commit 4a2ae88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 3 additions & 3 deletions rust/kernel/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
//!
//! ```rust
//! # #![allow(clippy::disallowed_names)]
//! # use kernel::{sync::Mutex, prelude::*, new_mutex, init::PinInit, try_pin_init};
//! # use kernel::{sync::Mutex, new_mutex, init::PinInit, try_pin_init};
//! #[pin_data]
//! struct DriverData {
//! #[pin]
Expand Down Expand Up @@ -122,7 +122,7 @@
//!
//! ```rust
//! # #![allow(unreachable_pub, clippy::disallowed_names)]
//! use kernel::{prelude::*, init, types::Opaque};
//! use kernel::{init, types::Opaque};
//! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
//! # mod bindings {
//! # #![allow(non_camel_case_types)]
Expand Down Expand Up @@ -413,7 +413,7 @@ macro_rules! stack_try_pin_init {
///
/// ```rust
/// # #![allow(clippy::disallowed_names)]
/// # use kernel::{init, pin_init, prelude::*, init::*};
/// # use kernel::{init, pin_init, init::*};
/// # use core::pin::Pin;
/// # #[pin_data]
/// # struct Foo {
Expand Down
3 changes: 0 additions & 3 deletions rust/kernel/workqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
//! we do not need to specify ids for the fields.
//!
//! ```
//! use kernel::prelude::*;
//! use kernel::sync::Arc;
//! use kernel::workqueue::{self, impl_has_work, new_work, Work, WorkItem};
//!
Expand Down Expand Up @@ -75,7 +74,6 @@
//! The following example shows how multiple `work_struct` fields can be used:
//!
//! ```
//! use kernel::prelude::*;
//! use kernel::sync::Arc;
//! use kernel::workqueue::{self, impl_has_work, new_work, Work, WorkItem};
//!
Expand Down Expand Up @@ -415,7 +413,6 @@ impl<T: ?Sized, const ID: u64> Work<T, ID> {
/// like this:
///
/// ```no_run
/// use kernel::prelude::*;
/// use kernel::workqueue::{impl_has_work, Work};
///
/// struct MyWorkItem {
Expand Down

0 comments on commit 4a2ae88

Please sign in to comment.