Add 'must_use' to all functions 'fn(float) -> float'
This commit is contained in:
parent
eeba189cfb
commit
6b02362b32
2 changed files with 56 additions and 0 deletions
|
|
@ -40,6 +40,7 @@ impl f32 {
|
|||
/// assert_eq!(g.floor(), 3.0);
|
||||
/// assert_eq!(h.floor(), -4.0);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn floor(self) -> f32 {
|
||||
|
|
@ -73,6 +74,7 @@ impl f32 {
|
|||
/// assert_eq!(f.ceil(), 4.0);
|
||||
/// assert_eq!(g.ceil(), 4.0);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn ceil(self) -> f32 {
|
||||
|
|
@ -95,6 +97,7 @@ impl f32 {
|
|||
/// assert_eq!(f.round(), 3.0);
|
||||
/// assert_eq!(g.round(), -3.0);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn round(self) -> f32 {
|
||||
|
|
@ -114,6 +117,7 @@ impl f32 {
|
|||
/// assert_eq!(g.trunc(), 3.0);
|
||||
/// assert_eq!(h.trunc(), -3.0);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn trunc(self) -> f32 {
|
||||
|
|
@ -135,6 +139,7 @@ impl f32 {
|
|||
/// assert!(abs_difference_x <= f32::EPSILON);
|
||||
/// assert!(abs_difference_y <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn fract(self) -> f32 { self - self.trunc() }
|
||||
|
|
@ -158,6 +163,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(f32::NAN.abs().is_nan());
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn abs(self) -> f32 {
|
||||
|
|
@ -182,6 +188,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(f32::NAN.signum().is_nan());
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn signum(self) -> f32 {
|
||||
|
|
@ -367,6 +374,7 @@ impl f32 {
|
|||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// assert!(negative.sqrt().is_nan());
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn sqrt(self) -> f32 {
|
||||
|
|
@ -393,6 +401,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn exp(self) -> f32 {
|
||||
|
|
@ -417,6 +426,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn exp2(self) -> f32 {
|
||||
|
|
@ -439,6 +449,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn ln(self) -> f32 {
|
||||
|
|
@ -485,6 +496,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn log2(self) -> f32 {
|
||||
|
|
@ -508,6 +520,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn log10(self) -> f32 {
|
||||
|
|
@ -565,6 +578,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn cbrt(self) -> f32 {
|
||||
|
|
@ -606,6 +620,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn sin(self) -> f32 {
|
||||
|
|
@ -629,6 +644,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn cos(self) -> f32 {
|
||||
|
|
@ -651,6 +667,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn tan(self) -> f32 {
|
||||
|
|
@ -673,6 +690,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn asin(self) -> f32 {
|
||||
|
|
@ -695,6 +713,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn acos(self) -> f32 {
|
||||
|
|
@ -716,6 +735,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn atan(self) -> f32 {
|
||||
|
|
@ -794,6 +814,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn exp_m1(self) -> f32 {
|
||||
|
|
@ -815,6 +836,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn ln_1p(self) -> f32 {
|
||||
|
|
@ -838,6 +860,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn sinh(self) -> f32 {
|
||||
|
|
@ -861,6 +884,7 @@ impl f32 {
|
|||
/// // Same result
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn cosh(self) -> f32 {
|
||||
|
|
@ -884,6 +908,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn tanh(self) -> f32 {
|
||||
|
|
@ -904,6 +929,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn asinh(self) -> f32 {
|
||||
|
|
@ -928,6 +954,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn acosh(self) -> f32 {
|
||||
|
|
@ -951,6 +978,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= 1e-5);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn atanh(self) -> f32 {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ impl f64 {
|
|||
/// assert_eq!(g.floor(), 3.0);
|
||||
/// assert_eq!(h.floor(), -4.0);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn floor(self) -> f64 {
|
||||
|
|
@ -57,6 +58,7 @@ impl f64 {
|
|||
/// assert_eq!(f.ceil(), 4.0);
|
||||
/// assert_eq!(g.ceil(), 4.0);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn ceil(self) -> f64 {
|
||||
|
|
@ -75,6 +77,7 @@ impl f64 {
|
|||
/// assert_eq!(f.round(), 3.0);
|
||||
/// assert_eq!(g.round(), -3.0);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn round(self) -> f64 {
|
||||
|
|
@ -94,6 +97,7 @@ impl f64 {
|
|||
/// assert_eq!(g.trunc(), 3.0);
|
||||
/// assert_eq!(h.trunc(), -3.0);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn trunc(self) -> f64 {
|
||||
|
|
@ -113,6 +117,7 @@ impl f64 {
|
|||
/// assert!(abs_difference_x < 1e-10);
|
||||
/// assert!(abs_difference_y < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn fract(self) -> f64 { self - self.trunc() }
|
||||
|
|
@ -136,6 +141,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(f64::NAN.abs().is_nan());
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn abs(self) -> f64 {
|
||||
|
|
@ -160,6 +166,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(f64::NAN.signum().is_nan());
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn signum(self) -> f64 {
|
||||
|
|
@ -332,6 +339,7 @@ impl f64 {
|
|||
/// assert!(abs_difference < 1e-10);
|
||||
/// assert!(negative.sqrt().is_nan());
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn sqrt(self) -> f64 {
|
||||
|
|
@ -356,6 +364,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn exp(self) -> f64 {
|
||||
|
|
@ -374,6 +383,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn exp2(self) -> f64 {
|
||||
|
|
@ -394,6 +404,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn ln(self) -> f64 {
|
||||
|
|
@ -432,6 +443,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn log2(self) -> f64 {
|
||||
|
|
@ -455,6 +467,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn log10(self) -> f64 {
|
||||
|
|
@ -504,6 +517,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn cbrt(self) -> f64 {
|
||||
|
|
@ -543,6 +557,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn sin(self) -> f64 {
|
||||
|
|
@ -562,6 +577,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn cos(self) -> f64 {
|
||||
|
|
@ -580,6 +596,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-14);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn tan(self) -> f64 {
|
||||
|
|
@ -602,6 +619,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn asin(self) -> f64 {
|
||||
|
|
@ -624,6 +642,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn acos(self) -> f64 {
|
||||
|
|
@ -643,6 +662,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn atan(self) -> f64 {
|
||||
|
|
@ -719,6 +739,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn exp_m1(self) -> f64 {
|
||||
|
|
@ -740,6 +761,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn ln_1p(self) -> f64 {
|
||||
|
|
@ -763,6 +785,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn sinh(self) -> f64 {
|
||||
|
|
@ -786,6 +809,7 @@ impl f64 {
|
|||
/// // Same result
|
||||
/// assert!(abs_difference < 1.0e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn cosh(self) -> f64 {
|
||||
|
|
@ -809,6 +833,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1.0e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn tanh(self) -> f64 {
|
||||
|
|
@ -827,6 +852,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1.0e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn asinh(self) -> f64 {
|
||||
|
|
@ -849,6 +875,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1.0e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn acosh(self) -> f64 {
|
||||
|
|
@ -872,6 +899,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1.0e-10);
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn atanh(self) -> f64 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue