Annotate functions taking extra args
This commit is contained in:
parent
ba2a1fa898
commit
c5b0003d99
2 changed files with 21 additions and 2 deletions
|
|
@ -220,8 +220,8 @@ impl f32 {
|
|||
///
|
||||
/// assert!(f32::NAN.copysign(1.0).is_nan());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[inline]
|
||||
#[stable(feature = "copysign", since = "1.35.0")]
|
||||
pub fn copysign(self, sign: f32) -> f32 {
|
||||
unsafe { intrinsics::copysignf32(self, sign) }
|
||||
|
|
@ -247,6 +247,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn mul_add(self, a: f32, b: f32) -> f32 {
|
||||
|
|
@ -270,6 +271,7 @@ impl f32 {
|
|||
/// assert_eq!(a.div_euclid(-b), -1.0); // 7.0 >= -4.0 * -1.0
|
||||
/// assert_eq!((-a).div_euclid(-b), 2.0); // -7.0 >= -4.0 * 2.0
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[inline]
|
||||
#[stable(feature = "euclidean_division", since = "1.38.0")]
|
||||
pub fn div_euclid(self, rhs: f32) -> f32 {
|
||||
|
|
@ -303,6 +305,7 @@ impl f32 {
|
|||
/// // limitation due to round-off error
|
||||
/// assert!((-std::f32::EPSILON).rem_euclid(3.0) != 0.0);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[inline]
|
||||
#[stable(feature = "euclidean_division", since = "1.38.0")]
|
||||
pub fn rem_euclid(self, rhs: f32) -> f32 {
|
||||
|
|
@ -329,6 +332,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn powi(self, n: i32) -> f32 {
|
||||
|
|
@ -347,6 +351,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn powf(self, n: f32) -> f32 {
|
||||
|
|
@ -478,6 +483,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn log(self, base: f32) -> f32 { self.ln() / base.ln() }
|
||||
|
|
@ -550,6 +556,7 @@ impl f32 {
|
|||
/// assert!(abs_difference_x <= f32::EPSILON);
|
||||
/// assert!(abs_difference_y <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
#[rustc_deprecated(since = "1.10.0",
|
||||
|
|
@ -601,6 +608,7 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn hypot(self, other: f32) -> f32 {
|
||||
|
|
@ -770,6 +778,7 @@ impl f32 {
|
|||
/// assert!(abs_difference_1 <= f32::EPSILON);
|
||||
/// assert!(abs_difference_2 <= f32::EPSILON);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn atan2(self, other: f32) -> f32 {
|
||||
|
|
@ -1006,6 +1015,7 @@ impl f32 {
|
|||
/// assert!((2.0f32).clamp(-2.0, 1.0) == 1.0);
|
||||
/// assert!((std::f32::NAN).clamp(-2.0, 1.0).is_nan());
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "clamp", issue = "44095")]
|
||||
#[inline]
|
||||
pub fn clamp(self, min: f32, max: f32) -> f32 {
|
||||
|
|
|
|||
|
|
@ -198,9 +198,9 @@ impl f64 {
|
|||
///
|
||||
/// assert!(f64::NAN.copysign(1.0).is_nan());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "copysign", since = "1.35.0")]
|
||||
#[inline]
|
||||
pub fn copysign(self, sign: f64) -> f64 {
|
||||
unsafe { intrinsics::copysignf64(self, sign) }
|
||||
}
|
||||
|
|
@ -223,6 +223,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn mul_add(self, a: f64, b: f64) -> f64 {
|
||||
|
|
@ -246,6 +247,7 @@ impl f64 {
|
|||
/// assert_eq!(a.div_euclid(-b), -1.0); // 7.0 >= -4.0 * -1.0
|
||||
/// assert_eq!((-a).div_euclid(-b), 2.0); // -7.0 >= -4.0 * 2.0
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[inline]
|
||||
#[stable(feature = "euclidean_division", since = "1.38.0")]
|
||||
pub fn div_euclid(self, rhs: f64) -> f64 {
|
||||
|
|
@ -279,6 +281,7 @@ impl f64 {
|
|||
/// // limitation due to round-off error
|
||||
/// assert!((-std::f64::EPSILON).rem_euclid(3.0) != 0.0);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[inline]
|
||||
#[stable(feature = "euclidean_division", since = "1.38.0")]
|
||||
pub fn rem_euclid(self, rhs: f64) -> f64 {
|
||||
|
|
@ -302,6 +305,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn powi(self, n: i32) -> f64 {
|
||||
|
|
@ -318,6 +322,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn powf(self, n: f64) -> f64 {
|
||||
|
|
@ -427,6 +432,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn log(self, base: f64) -> f64 { self.ln() / base.ln() }
|
||||
|
|
@ -491,6 +497,7 @@ impl f64 {
|
|||
/// assert!(abs_difference_x < 1e-10);
|
||||
/// assert!(abs_difference_y < 1e-10);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
#[rustc_deprecated(since = "1.10.0",
|
||||
|
|
@ -538,6 +545,7 @@ impl f64 {
|
|||
///
|
||||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn hypot(self, other: f64) -> f64 {
|
||||
|
|
@ -697,6 +705,7 @@ impl f64 {
|
|||
/// assert!(abs_difference_1 < 1e-10);
|
||||
/// assert!(abs_difference_2 < 1e-10);
|
||||
/// ```
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn atan2(self, other: f64) -> f64 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue