Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The small abstraction function `shr_exact` is missing the `#[inline]` attribute. --
--- Patch [3]: [PATCH 03/12] rust: num: add Bounded::shr_exact --- commit fe8d74a80e41351c792119ee859ab7990c063f88 Author: Eliot Courtney <[email protected]> rust: num: add Bounded::shr_exact This commit adds shr_exact to shift a bounded value right only if it loses no set bits. This is useful for getting a shifted down integer while simultaneously checking that it is aligned. > diff --git a/rust/kernel/num/bounded.rs b/rust/kernel/num/bounded.rs > index f263107f001ed..2695a7858d8ad 100644 > --- a/rust/kernel/num/bounded.rs > +++ b/rust/kernel/num/bounded.rs [ ... ] > + /// // A set bit would be shifted out. > + /// let v = Bounded::<u32, 16>::new::<0xff01>(); > + /// let v_shifted: Option<Bounded<u32, 8>> = v.shr_exact::<8, _>(); > + /// > + /// assert!(v_shifted.is_none()); > + /// ``` > + pub fn shr_exact<const SHIFT: u32, const RES: u32>(self) -> > Option<Bounded<T, RES>> { [Severity: Low] This isn't a bug, but should this small abstraction function be annotated with #[inline]? According to the Rust subsystem coding guidelines, functions that are small or forwarding to a binding call should be annotated with #[inline]. > + let shifted = self.shr::<SHIFT, RES>(); > + if shifted.get() << SHIFT == self.0 { > + Some(shifted) > + } else { > + None > + } > + } -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3
