rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Optimise Msrv for common one item case

Open GnomedDev opened this issue 1 year ago • 4 comments

Currently, Msrv is cloned around a lot in order to handle the #[clippy::msrv] attribute. This attribute, however, means RustcVersion will be heap allocated if there is only one source of an msrv (eg: rust-version in Cargo.toml).

This PR optimizes for said case, while keeping the external interface the same by:

  • Storing RustVersion inline for the common one element case.
  • Swapping to ThinVec to shrink Msrv to 16 bytes, from 24, to optimize for the zero and one element cases.

changelog: none

GnomedDev avatar Sep 28 '24 14:09 GnomedDev