Re: [PATCH] rust: num: Add inline annotation to Bounded methods

From: Alice Ryhl

Date: Mon Oct 19 2026 - 12:09:00 EST


On Mon, Oct 19, 2026 at 12:57:38PM +0200, Link Mauve wrote:
> It was previously generating a ton of very short functions, such as
> <<kernel::num::bounded::Bounded<u32, 32>>::shr::<17, 15>> or
> <<kernel::num::bounded::Bounded<u16, 16>>::new::<16384>> on use.
>
> These are obviously better inlined, although I wasn’t completely sure
> between #[inline] and #[inline(always)], but the former worked fine in
> my setup so I went for it, we can always adjust it later.
>
> Signed-off-by: Link Mauve <linkmauve@xxxxxxxxxxxx>

I agree with using #[inline] here. You only want #[inline(always)] when
you are using build_assert!() in a way that depends on function
arguments.

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>