Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneeded kernel::prelude::*s from doctests #1064

Closed
ojeda opened this issue Feb 18, 2024 · 6 comments
Closed

Remove unneeded kernel::prelude::*s from doctests #1064

ojeda opened this issue Feb 18, 2024 · 6 comments
Labels
good first issue Good for newcomers • lib Related to the `rust/` library.

Comments

@ojeda
Copy link
Member

ojeda commented Feb 18, 2024

In the kernel, Rust doctests implicitly include kernel::prelude::*. Thus remove it from all doctests from where it may make sense, and double-check they all still compile and pass by running them, e.g. under QEMU or with the KUnit script (see upcoming documentation about how to do so at https://lore.kernel.org/rust-for-linux/20240130075117.4137360-2-dirk.behme@de.bosch.com/).


This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a Suggested-by: tag and a Link: tag to this issue. Please see https://rust-for-linux.com/contributing for details.

Please take this issue only if you are new to the kernel development process and you would like to use it as a test to submit your first patch to the kernel. Please do not take it if you do not plan to make other contributions to the kernel.

@ojeda ojeda added • lib Related to the `rust/` library. good first issue Good for newcomers labels Feb 18, 2024
@nellshamrell
Copy link

I would love to work on this issue this week.

@ojeda
Copy link
Member Author

ojeda commented Mar 25, 2024

Of course, please feel free to -- thanks!

@nellshamrell
Copy link

nellshamrell commented Apr 1, 2024

Instances of kernel::prelude in doctests

Tested Examples

Untested Examples to possibly re-work

Note from zulip on linux/rust/macros/lib.rs

Other instances

Instances of kernel::{prelude::*, ...} in doctests

@nellshamrell
Copy link

A patch for this was submitted to the LKML :)

ojeda pushed a commit to ojeda/linux that referenced this issue May 5, 2024
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>
@ojeda
Copy link
Member Author

ojeda commented May 19, 2024

This is now in mainline: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4a2ae8805129

Thanks again!

@ojeda ojeda closed this as completed May 19, 2024
@nellshamrell
Copy link

Amazing! Ty for the opportunity!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers • lib Related to the `rust/` library.
Development

No branches or pull requests

2 participants