rust: remove unneeded `kernel::prelude` imports from doctests
Subsystems (5)
PATCH 1/1 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 <[email protected]>
Signed-off-by Nell Shamrell-Harrington <[email protected]>
--- rust/kernel/init.rs | 6 +++--- rust/kernel/net/phy.rs | 1 - rust/kernel/workqueue.rs | 3 --- 3 files changed, 3 insertions(+), 7 deletions(-)
rust/kernel/init.rs +3 -3
@@ -87,7 +87,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]
@@ -121,7 +121,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)]
@@ -412,7 +412,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 {
rust/kernel/net/phy.rs +0 -1
@@ -766,7 +766,6 @@ const fn as_int(&self) -> u32 {/// # mod module_phy_driver_sample { /// use kernel::c_str; /// use kernel::net::phy::{self, DeviceId}; -/// use kernel::prelude::*; /// /// kernel::module_phy_driver! { /// drivers: [PhySample],
rust/kernel/workqueue.rs +0 -3
@@ -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}; //!
@@ -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}; //!
@@ -411,7 +409,6 @@ pub unsafe fn raw_get(ptr: *const Self) -> *mut bindings::work_struct {/// like this: /// /// ```no_run -/// use kernel::prelude::*; /// use kernel::workqueue::{impl_has_work, Work}; /// /// struct MyWorkItem {
Signature · 1 line
2.34.1
Quoted 4 lines · Nell Shamrell-Harrington
Rust doctests implicitly include
kernel::prelude::*.Removes explicit
kernel::preludeimports from doctests.
Quoted 8 lines
Suggested-by Miguel Ojeda <[email protected]>Signed-off-by Nell Shamrell-Harrington <[email protected]>--- rust/kernel/init.rs | 6 +++--- rust/kernel/net/phy.rs | 1 - rust/kernel/workqueue.rs | 3 --- 3 files changed, 3 insertions(+), 7 deletions(-)
Reviewed-by Benno Lossin <[email protected]>
Signature · 2 lines
Cheers, Benno
Miguel Ojeda
AppliedQuoted 8 lines · Nell Shamrell-Harrington
Rust doctests implicitly include
kernel::prelude::*.Removes explicit
kernel::preludeimports from doctests.Suggested-by Miguel Ojeda <[email protected]>Signed-off-by Nell Shamrell-Harrington <[email protected]>
[ Add it back for module_phy_driver's example since it is within a mod, and thus it cannot be removed. - Miguel ]
Nell: please double-check the above is correct (I guess you didn't enable net/phy and thus didn't notice since it didn't get compiled?).
Applied to rust-next -- thanks everyone!
Cheers,
Miguel