Revert "Fix documentation and formatting."

This reverts commit 2e34ff7671.
This commit is contained in:
Jacob Kiesel 2017-09-08 16:07:13 -06:00
parent 67283fa8e6
commit 8b96167004
3 changed files with 11 additions and 15 deletions

View File

@ -483,7 +483,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
}
/// Returns max if self is greater than max, and min if self is less than min.
/// Otherwise this will return self.
/// Otherwise this will return self. Panics if min > max.
///
/// # Examples
///
@ -494,16 +494,18 @@ pub trait Ord: Eq + PartialOrd<Self> {
/// 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 }
if self < min {
min
}
else if self > max {
max
} else {
self
}
}
}

View File

@ -1081,7 +1081,7 @@ impl f32 {
}
/// Returns max if self is greater than max, and min if self is less than min.
/// Otherwise this returns self.
/// Otherwise this returns self. Panics if min > max, min is NaN, or max is NaN.
///
/// # Examples
///
@ -1093,9 +1093,6 @@ impl f32 {
/// assert!((2.0f32).clamp(-2.0f32, 1.0f32) == 1.0f32);
/// assert!((NAN).clamp(-2.0f32, 1.0f32).is_nan());
/// ```
///
/// # Panics
/// Panics if min > max, min is NaN, or max is NaN.
#[unstable(feature = "clamp", issue = "44095")]
#[inline]
pub fn clamp(self, min: f32, max: f32) -> f32 {

View File

@ -971,7 +971,7 @@ impl f64 {
}
/// Returns max if self is greater than max, and min if self is less than min.
/// Otherwise this returns self.
/// Otherwise this returns self. Panics if min > max, min is NaN, or max is NaN.
///
/// # Examples
///
@ -983,9 +983,6 @@ impl f64 {
/// assert!((2.0f64).clamp(-2.0f64, 1.0f64) == 1.0f64);
/// assert!((NAN).clamp(-2.0f64, 1.0f64).is_nan());
/// ```
///
/// # Panics
/// Panics if min > max, min is NaN, or max is NaN.
#[unstable(feature = "clamp", issue = "44095")]
#[inline]
pub fn clamp(self, min: f64, max: f64) -> f64 {