Rollup merge of #125455 - blyxyas:opt-clamp, r=joboet

Make `clamp` inline

Context: rust-lang/rust-clippy#12826
This results in slightly more optimized assembly. (And most important, it's now less than lines than just manually clamping a value)
This commit is contained in:
Matthias Krüger 2024-05-24 17:48:02 +02:00 committed by GitHub
commit 268657b40b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -898,6 +898,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
/// assert_eq!(2.clamp(-2, 1), 1);
/// ```
#[must_use]
#[inline]
#[stable(feature = "clamp", since = "1.50.0")]
fn clamp(self, min: Self, max: Self) -> Self
where