Remove legacy default implementations

This commit is contained in:
Yoan Lecoq 2018-01-18 21:32:46 +01:00
parent a2337f392b
commit 1e892e2238
1 changed files with 3 additions and 15 deletions

View File

@ -56,9 +56,7 @@ pub trait Real
/// ///
/// The default implementation will panic if `f32::EPSILON` cannot /// The default implementation will panic if `f32::EPSILON` cannot
/// be cast to `Self`. /// be cast to `Self`.
fn epsilon() -> Self { fn epsilon() -> Self;
Self::from(::std::f32::EPSILON).expect("Unable to cast from f32::EPSILON")
}
/// Returns the largest finite value that this type can represent. /// Returns the largest finite value that this type can represent.
/// ///
@ -412,12 +410,7 @@ pub trait Real
/// ///
/// assert!(abs_difference < 1e-10); /// assert!(abs_difference < 1e-10);
/// ``` /// ```
#[inline] fn to_degrees(self) -> Self;
fn to_degrees(self) -> Self {
let halfpi = Self::zero().acos();
let ninety = Self::from(90u8).unwrap();
self * ninety / halfpi
}
/// Converts degrees to radians. /// Converts degrees to radians.
/// ///
@ -430,12 +423,7 @@ pub trait Real
/// ///
/// assert!(abs_difference < 1e-10); /// assert!(abs_difference < 1e-10);
/// ``` /// ```
#[inline] fn to_radians(self) -> Self;
fn to_radians(self) -> Self {
let halfpi = Self::zero().acos();
let ninety = Self::from(90u8).unwrap();
self * halfpi / ninety
}
/// Returns the maximum of the two numbers. /// Returns the maximum of the two numbers.
/// ///