diff options
author | Jacob Kiesel <kieseljake@gmail.com> | 2017-09-08 16:07:21 -0600 |
---|---|---|
committer | Jacob Kiesel <kieseljake@gmail.com> | 2017-09-08 16:07:21 -0600 |
commit | db5b5f97063bd12cb5fb857e33cc5b417b408ef8 (patch) | |
tree | 786ef0a77030c1d27e16ece0cd8a7b7e57e2cc60 /src/libcore/cmp.rs | |
parent | 63f4dab0f5049bda995d043ac6c1bdd05a9865e6 (diff) | |
download | rust-db5b5f97063bd12cb5fb857e33cc5b417b408ef8.tar.gz |
Revert "Add clamp functions"
This reverts commit c589f867f89d4e6e48c6602aed8e878208d4822f.
Diffstat (limited to 'src/libcore/cmp.rs')
-rw-r--r-- | src/libcore/cmp.rs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 174ceb6b8a7..ec6525485f7 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -481,32 +481,6 @@ pub trait Ord: Eq + PartialOrd<Self> { where Self: Sized { if self <= other { self } else { other } } - - /// Returns max if self is greater than max, and min if self is less than min. - /// Otherwise this will return self. Panics if min > max. - /// - /// # Examples - /// - /// ``` - /// #![feature(clamp)] - /// - /// assert!((-3).clamp(-2, 1) == -2); - /// assert!(0.clamp(-2, 1) == 0); - /// assert!(2.clamp(-2, 1) == 1); - /// ``` - #[unstable(feature = "clamp", issue = "44095")] - fn clamp(self, min: Self, max: Self) -> Self - where Self: Sized { - assert!(min <= max); - if self < min { - min - } - else if self > max { - max - } else { - self - } - } } #[stable(feature = "rust1", since = "1.0.0")] |