Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] rust: missing #[inline] on try_push_init and extend_from_slice
--

commit 83efda44f14b36e4aab4040f689c08677c6c23f1
Author: Eliot Courtney <[email protected]>

rust: alloc: add ArrayVec

Add a fixed capacity vector backed by [MaybeUninit<T>; N]. The ArrayVec
is also initializable with a closure, returning an Init instance, to
avoid constructing it on the stack.

> diff --git a/rust/kernel/alloc/arrayvec.rs b/rust/kernel/alloc/arrayvec.rs
> new file mode 100644
> index 0000000000000..8793adf4d27b7
> --- /dev/null
> +++ b/rust/kernel/alloc/arrayvec.rs

[ ... ]

> +    /// Appends an element to the back of the [`ArrayVec`] by initializing 
> it in place.
> +    ///
> +    /// Unlike [`ArrayVec::push_init`], the initializer may be fallible. If 
> the [`ArrayVec`] is
> +    /// full, the original initializer `init` is handed back in 
> [`TryPushInitError::Full`]. If the
> +    /// initializer itself fails, its error is returned in 
> [`TryPushInitError::InitError`].
> +    pub fn try_push_init<I, E>(&mut self, init: I) -> Result<(), 
> TryPushInitError<I, E>>
> +    where
> +        I: Init<T, E>,
> +    {
> +        let Some(slot) = self.spare_capacity_mut().first_mut() else {

[Severity: Low]
This isn't a bug, but is try_push_init() missing an #[inline] attribute?
The Rust subsystem coding guidelines state that small functions in abstractions
should be annotated with #[inline].

[ ... ]

> +    /// Appends a clone of each element in `slice` to the back of the 
> [`ArrayVec`].
> +    ///
> +    /// Fails with [`EINVAL`] if `slice` is longer than the remaining 
> capacity.
> +    pub fn extend_from_slice(&mut self, slice: &[T]) -> Result
> +    where
> +        T: Clone,
> +    {
> +        let Some(dst) = self.spare_capacity_mut().get_mut(..slice.len()) 
> else {

[Severity: Low]
This isn't a bug, but is extend_from_slice() also missing an #[inline]
attribute? The Rust subsystem coding guidelines state that small functions in
abstractions should be annotated with #[inline].

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to