@@ -220,8 +220,8 @@ impl f32 {
220
220
///
221
221
/// assert!(f32::NAN.copysign(1.0).is_nan());
222
222
/// ```
223
- #[ inline]
224
223
#[ must_use = "method returns a new number and does not mutate the original value" ]
224
+ #[ inline]
225
225
#[ stable( feature = "copysign" , since = "1.35.0" ) ]
226
226
pub fn copysign ( self , sign : f32 ) -> f32 {
227
227
unsafe { intrinsics:: copysignf32 ( self , sign) }
@@ -247,6 +247,7 @@ impl f32 {
247
247
///
248
248
/// assert!(abs_difference <= f32::EPSILON);
249
249
/// ```
250
+ #[ must_use = "method returns a new number and does not mutate the original value" ]
250
251
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
251
252
#[ inline]
252
253
pub fn mul_add ( self , a : f32 , b : f32 ) -> f32 {
@@ -270,6 +271,7 @@ impl f32 {
270
271
/// assert_eq!(a.div_euclid(-b), -1.0); // 7.0 >= -4.0 * -1.0
271
272
/// assert_eq!((-a).div_euclid(-b), 2.0); // -7.0 >= -4.0 * 2.0
272
273
/// ```
274
+ #[ must_use = "method returns a new number and does not mutate the original value" ]
273
275
#[ inline]
274
276
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
275
277
pub fn div_euclid ( self , rhs : f32 ) -> f32 {
@@ -303,6 +305,7 @@ impl f32 {
303
305
/// // limitation due to round-off error
304
306
/// assert!((-std::f32::EPSILON).rem_euclid(3.0) != 0.0);
305
307
/// ```
308
+ #[ must_use = "method returns a new number and does not mutate the original value" ]
306
309
#[ inline]
307
310
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
308
311
pub fn rem_euclid ( self , rhs : f32 ) -> f32 {
@@ -329,6 +332,7 @@ impl f32 {
329
332
///
330
333
/// assert!(abs_difference <= f32::EPSILON);
331
334
/// ```
335
+ #[ must_use = "method returns a new number and does not mutate the original value" ]
332
336
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
333
337
#[ inline]
334
338
pub fn powi ( self , n : i32 ) -> f32 {
@@ -347,6 +351,7 @@ impl f32 {
347
351
///
348
352
/// assert!(abs_difference <= f32::EPSILON);
349
353
/// ```
354
+ #[ must_use = "method returns a new number and does not mutate the original value" ]
350
355
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
351
356
#[ inline]
352
357
pub fn powf ( self , n : f32 ) -> f32 {
@@ -478,6 +483,7 @@ impl f32 {
478
483
///
479
484
/// assert!(abs_difference <= f32::EPSILON);
480
485
/// ```
486
+ #[ must_use = "method returns a new number and does not mutate the original value" ]
481
487
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
482
488
#[ inline]
483
489
pub fn log ( self , base : f32 ) -> f32 { self . ln ( ) / base. ln ( ) }
@@ -550,6 +556,7 @@ impl f32 {
550
556
/// assert!(abs_difference_x <= f32::EPSILON);
551
557
/// assert!(abs_difference_y <= f32::EPSILON);
552
558
/// ```
559
+ #[ must_use = "method returns a new number and does not mutate the original value" ]
553
560
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
554
561
#[ inline]
555
562
#[ rustc_deprecated( since = "1.10.0" ,
@@ -601,6 +608,7 @@ impl f32 {
601
608
///
602
609
/// assert!(abs_difference <= f32::EPSILON);
603
610
/// ```
611
+ #[ must_use = "method returns a new number and does not mutate the original value" ]
604
612
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
605
613
#[ inline]
606
614
pub fn hypot ( self , other : f32 ) -> f32 {
@@ -770,6 +778,7 @@ impl f32 {
770
778
/// assert!(abs_difference_1 <= f32::EPSILON);
771
779
/// assert!(abs_difference_2 <= f32::EPSILON);
772
780
/// ```
781
+ #[ must_use = "method returns a new number and does not mutate the original value" ]
773
782
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
774
783
#[ inline]
775
784
pub fn atan2 ( self , other : f32 ) -> f32 {
@@ -1006,6 +1015,7 @@ impl f32 {
1006
1015
/// assert!((2.0f32).clamp(-2.0, 1.0) == 1.0);
1007
1016
/// assert!((std::f32::NAN).clamp(-2.0, 1.0).is_nan());
1008
1017
/// ```
1018
+ #[ must_use = "method returns a new number and does not mutate the original value" ]
1009
1019
#[ unstable( feature = "clamp" , issue = "44095" ) ]
1010
1020
#[ inline]
1011
1021
pub fn clamp ( self , min : f32 , max : f32 ) -> f32 {
0 commit comments