Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The new imports in the documentation tests violate the kernel vertical import style.
--
--- Patch [5]: [PATCH v6 5/7] rust: id_pool: take a NonZero capacity in with_capacity ---
commit e9e2e8ccc28f355c2c0d256d428875b948d75705
Author: Eliot Courtney <[email protected]>
rust: id_pool: take a NonZero capacity in with_capacity
This commit updates IdPool::with_capacity to take a NonZero capacity,
as an IdPool should not be allocated with zero capacity.
> diff --git a/rust/kernel/id_pool.rs b/rust/kernel/id_pool.rs
> --- a/rust/kernel/id_pool.rs
> +++ b/rust/kernel/id_pool.rs
> @@ -29,10 +29,11 @@
> /// Basic usage
> ///
> /// ```
> +/// use core::num::NonZero;
> /// use kernel::alloc::AllocError;
[Severity: Low]
This isn't a bug, but should there be a blank line between the core:: and
kernel:: imports to follow the kernel vertical import style?
> /// use kernel::id_pool::{IdPool, UnusedId};
> ///
> -/// let mut pool = IdPool::with_capacity(64, GFP_KERNEL)?;
> +/// let mut pool = IdPool::with_capacity(NonZero::new(64).unwrap(), GFP_KERNEL)?;
[ ... ]
> @@ -138,6 +139,7 @@ pub fn capacity(&self) -> usize {
> /// # Examples
> ///
> /// ```
> +/// use core::num::NonZero;
> /// use kernel::{
[Severity: Low]
This isn't a bug, but could we add a blank line here as well to separate the
core imports from the kernel imports?
> /// alloc::AllocError,
> /// bitmap::BitmapVec,
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.