Skip to content

Commit

Permalink
Unrolled build for rust-lang#125455
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#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)
  • Loading branch information
rust-timer committed May 24, 2024
2 parents 9e297bf + d6e6918 commit ae1ebed
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/core/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ae1ebed

Please sign in to comment.