On Sun Mar 1, 2026 at 8:25 PM CET, Gary Guo wrote: > `#[inline]` is a hint to make it more likely for compilers to inline. Without > them, you're relying on compiler heurstics only. There're cases (especially > with > abstractions) where the function may look complex as it contains lots of > function calls (so compiler heurstics avoid inlining them), but they're all > zero-cost abstractions so eventually things get optimized away. > > For non-generic functions, there is additional issue where only very small > functions get automatically inlined, otherwise a single copy is generated at > the > defining crate and compiler run on a dependant crate has no chance to even > peek > what's in the function. > > If you know a function should be inlined, it's better to just mark them as > such, > so there're no surprises.
Should we set clippy::missing_inline_in_public_items [1] to "warn"? [1]: https://rust-lang.github.io/rust-clippy/master/index.html?search=missing_inline_in_public_items Cheers, Benno
