]> git.lizzy.rs Git - rust.git/blobdiff - src/libcore/cmp.rs
Rollup merge of #44562 - eddyb:ugh-rustdoc, r=nikomatsakis
[rust.git] / src / libcore / cmp.rs
index dc1f2981a50ad7406754e74f6adf0573140e0a2e..6f86f8caad07343cc87f94310fc75040a00a2856 100644 (file)
@@ -453,12 +453,10 @@ pub trait Ord: Eq + PartialOrd<Self> {
     /// # Examples
     ///
     /// ```
-    /// #![feature(ord_max_min)]
-    ///
     /// assert_eq!(2, 1.max(2));
     /// assert_eq!(2, 2.max(2));
     /// ```
-    #[unstable(feature = "ord_max_min", issue = "25663")]
+    #[stable(feature = "ord_max_min", since = "1.22.0")]
     fn max(self, other: Self) -> Self
     where Self: Sized {
         if other >= self { other } else { self }
@@ -471,40 +469,14 @@ fn max(self, other: Self) -> Self
     /// # Examples
     ///
     /// ```
-    /// #![feature(ord_max_min)]
-    ///
     /// assert_eq!(1, 1.min(2));
     /// assert_eq!(2, 2.min(2));
     /// ```
-    #[unstable(feature = "ord_max_min", issue = "25663")]
+    #[stable(feature = "ord_max_min", since = "1.22.0")]
     fn min(self, other: Self) -> 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.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// #![feature(clamp)]
-    ///
-    /// assert!((-3).clamp(-2, 1) == -2);
-    /// assert!(0.clamp(-2, 1) == 0);
-    /// assert!(2.clamp(-2, 1) == 1);
-    /// ```
-    ///
-    /// # Panics
-    /// Panics if min > max.
-    #[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")]