Skip to content

Commit ba2a1fa

Browse files
author
Kyle Strand
committed
Add reason for each 'must_use'
1 parent 6b02362 commit ba2a1fa

File tree

2 files changed

+58
-58
lines changed

2 files changed

+58
-58
lines changed

src/libstd/f32.rs

+29-29
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl f32 {
4040
/// assert_eq!(g.floor(), 3.0);
4141
/// assert_eq!(h.floor(), -4.0);
4242
/// ```
43-
#[must_use]
43+
#[must_use = "method returns a new number and does not mutate the original value"]
4444
#[stable(feature = "rust1", since = "1.0.0")]
4545
#[inline]
4646
pub fn floor(self) -> f32 {
@@ -74,7 +74,7 @@ impl f32 {
7474
/// assert_eq!(f.ceil(), 4.0);
7575
/// assert_eq!(g.ceil(), 4.0);
7676
/// ```
77-
#[must_use]
77+
#[must_use = "method returns a new number and does not mutate the original value"]
7878
#[stable(feature = "rust1", since = "1.0.0")]
7979
#[inline]
8080
pub fn ceil(self) -> f32 {
@@ -97,7 +97,7 @@ impl f32 {
9797
/// assert_eq!(f.round(), 3.0);
9898
/// assert_eq!(g.round(), -3.0);
9999
/// ```
100-
#[must_use]
100+
#[must_use = "method returns a new number and does not mutate the original value"]
101101
#[stable(feature = "rust1", since = "1.0.0")]
102102
#[inline]
103103
pub fn round(self) -> f32 {
@@ -117,7 +117,7 @@ impl f32 {
117117
/// assert_eq!(g.trunc(), 3.0);
118118
/// assert_eq!(h.trunc(), -3.0);
119119
/// ```
120-
#[must_use]
120+
#[must_use = "method returns a new number and does not mutate the original value"]
121121
#[stable(feature = "rust1", since = "1.0.0")]
122122
#[inline]
123123
pub fn trunc(self) -> f32 {
@@ -139,7 +139,7 @@ impl f32 {
139139
/// assert!(abs_difference_x <= f32::EPSILON);
140140
/// assert!(abs_difference_y <= f32::EPSILON);
141141
/// ```
142-
#[must_use]
142+
#[must_use = "method returns a new number and does not mutate the original value"]
143143
#[stable(feature = "rust1", since = "1.0.0")]
144144
#[inline]
145145
pub fn fract(self) -> f32 { self - self.trunc() }
@@ -163,7 +163,7 @@ impl f32 {
163163
///
164164
/// assert!(f32::NAN.abs().is_nan());
165165
/// ```
166-
#[must_use]
166+
#[must_use = "method returns a new number and does not mutate the original value"]
167167
#[stable(feature = "rust1", since = "1.0.0")]
168168
#[inline]
169169
pub fn abs(self) -> f32 {
@@ -188,7 +188,7 @@ impl f32 {
188188
///
189189
/// assert!(f32::NAN.signum().is_nan());
190190
/// ```
191-
#[must_use]
191+
#[must_use = "method returns a new number and does not mutate the original value"]
192192
#[stable(feature = "rust1", since = "1.0.0")]
193193
#[inline]
194194
pub fn signum(self) -> f32 {
@@ -221,7 +221,7 @@ impl f32 {
221221
/// assert!(f32::NAN.copysign(1.0).is_nan());
222222
/// ```
223223
#[inline]
224-
#[must_use]
224+
#[must_use = "method returns a new number and does not mutate the original value"]
225225
#[stable(feature = "copysign", since = "1.35.0")]
226226
pub fn copysign(self, sign: f32) -> f32 {
227227
unsafe { intrinsics::copysignf32(self, sign) }
@@ -374,7 +374,7 @@ impl f32 {
374374
/// assert!(abs_difference <= f32::EPSILON);
375375
/// assert!(negative.sqrt().is_nan());
376376
/// ```
377-
#[must_use]
377+
#[must_use = "method returns a new number and does not mutate the original value"]
378378
#[stable(feature = "rust1", since = "1.0.0")]
379379
#[inline]
380380
pub fn sqrt(self) -> f32 {
@@ -401,7 +401,7 @@ impl f32 {
401401
///
402402
/// assert!(abs_difference <= f32::EPSILON);
403403
/// ```
404-
#[must_use]
404+
#[must_use = "method returns a new number and does not mutate the original value"]
405405
#[stable(feature = "rust1", since = "1.0.0")]
406406
#[inline]
407407
pub fn exp(self) -> f32 {
@@ -426,7 +426,7 @@ impl f32 {
426426
///
427427
/// assert!(abs_difference <= f32::EPSILON);
428428
/// ```
429-
#[must_use]
429+
#[must_use = "method returns a new number and does not mutate the original value"]
430430
#[stable(feature = "rust1", since = "1.0.0")]
431431
#[inline]
432432
pub fn exp2(self) -> f32 {
@@ -449,7 +449,7 @@ impl f32 {
449449
///
450450
/// assert!(abs_difference <= f32::EPSILON);
451451
/// ```
452-
#[must_use]
452+
#[must_use = "method returns a new number and does not mutate the original value"]
453453
#[stable(feature = "rust1", since = "1.0.0")]
454454
#[inline]
455455
pub fn ln(self) -> f32 {
@@ -496,7 +496,7 @@ impl f32 {
496496
///
497497
/// assert!(abs_difference <= f32::EPSILON);
498498
/// ```
499-
#[must_use]
499+
#[must_use = "method returns a new number and does not mutate the original value"]
500500
#[stable(feature = "rust1", since = "1.0.0")]
501501
#[inline]
502502
pub fn log2(self) -> f32 {
@@ -520,7 +520,7 @@ impl f32 {
520520
///
521521
/// assert!(abs_difference <= f32::EPSILON);
522522
/// ```
523-
#[must_use]
523+
#[must_use = "method returns a new number and does not mutate the original value"]
524524
#[stable(feature = "rust1", since = "1.0.0")]
525525
#[inline]
526526
pub fn log10(self) -> f32 {
@@ -578,7 +578,7 @@ impl f32 {
578578
///
579579
/// assert!(abs_difference <= f32::EPSILON);
580580
/// ```
581-
#[must_use]
581+
#[must_use = "method returns a new number and does not mutate the original value"]
582582
#[stable(feature = "rust1", since = "1.0.0")]
583583
#[inline]
584584
pub fn cbrt(self) -> f32 {
@@ -620,7 +620,7 @@ impl f32 {
620620
///
621621
/// assert!(abs_difference <= f32::EPSILON);
622622
/// ```
623-
#[must_use]
623+
#[must_use = "method returns a new number and does not mutate the original value"]
624624
#[stable(feature = "rust1", since = "1.0.0")]
625625
#[inline]
626626
pub fn sin(self) -> f32 {
@@ -644,7 +644,7 @@ impl f32 {
644644
///
645645
/// assert!(abs_difference <= f32::EPSILON);
646646
/// ```
647-
#[must_use]
647+
#[must_use = "method returns a new number and does not mutate the original value"]
648648
#[stable(feature = "rust1", since = "1.0.0")]
649649
#[inline]
650650
pub fn cos(self) -> f32 {
@@ -667,7 +667,7 @@ impl f32 {
667667
///
668668
/// assert!(abs_difference <= f32::EPSILON);
669669
/// ```
670-
#[must_use]
670+
#[must_use = "method returns a new number and does not mutate the original value"]
671671
#[stable(feature = "rust1", since = "1.0.0")]
672672
#[inline]
673673
pub fn tan(self) -> f32 {
@@ -690,7 +690,7 @@ impl f32 {
690690
///
691691
/// assert!(abs_difference <= f32::EPSILON);
692692
/// ```
693-
#[must_use]
693+
#[must_use = "method returns a new number and does not mutate the original value"]
694694
#[stable(feature = "rust1", since = "1.0.0")]
695695
#[inline]
696696
pub fn asin(self) -> f32 {
@@ -713,7 +713,7 @@ impl f32 {
713713
///
714714
/// assert!(abs_difference <= f32::EPSILON);
715715
/// ```
716-
#[must_use]
716+
#[must_use = "method returns a new number and does not mutate the original value"]
717717
#[stable(feature = "rust1", since = "1.0.0")]
718718
#[inline]
719719
pub fn acos(self) -> f32 {
@@ -735,7 +735,7 @@ impl f32 {
735735
///
736736
/// assert!(abs_difference <= f32::EPSILON);
737737
/// ```
738-
#[must_use]
738+
#[must_use = "method returns a new number and does not mutate the original value"]
739739
#[stable(feature = "rust1", since = "1.0.0")]
740740
#[inline]
741741
pub fn atan(self) -> f32 {
@@ -814,7 +814,7 @@ impl f32 {
814814
///
815815
/// assert!(abs_difference <= f32::EPSILON);
816816
/// ```
817-
#[must_use]
817+
#[must_use = "method returns a new number and does not mutate the original value"]
818818
#[stable(feature = "rust1", since = "1.0.0")]
819819
#[inline]
820820
pub fn exp_m1(self) -> f32 {
@@ -836,7 +836,7 @@ impl f32 {
836836
///
837837
/// assert!(abs_difference <= f32::EPSILON);
838838
/// ```
839-
#[must_use]
839+
#[must_use = "method returns a new number and does not mutate the original value"]
840840
#[stable(feature = "rust1", since = "1.0.0")]
841841
#[inline]
842842
pub fn ln_1p(self) -> f32 {
@@ -860,7 +860,7 @@ impl f32 {
860860
///
861861
/// assert!(abs_difference <= f32::EPSILON);
862862
/// ```
863-
#[must_use]
863+
#[must_use = "method returns a new number and does not mutate the original value"]
864864
#[stable(feature = "rust1", since = "1.0.0")]
865865
#[inline]
866866
pub fn sinh(self) -> f32 {
@@ -884,7 +884,7 @@ impl f32 {
884884
/// // Same result
885885
/// assert!(abs_difference <= f32::EPSILON);
886886
/// ```
887-
#[must_use]
887+
#[must_use = "method returns a new number and does not mutate the original value"]
888888
#[stable(feature = "rust1", since = "1.0.0")]
889889
#[inline]
890890
pub fn cosh(self) -> f32 {
@@ -908,7 +908,7 @@ impl f32 {
908908
///
909909
/// assert!(abs_difference <= f32::EPSILON);
910910
/// ```
911-
#[must_use]
911+
#[must_use = "method returns a new number and does not mutate the original value"]
912912
#[stable(feature = "rust1", since = "1.0.0")]
913913
#[inline]
914914
pub fn tanh(self) -> f32 {
@@ -929,7 +929,7 @@ impl f32 {
929929
///
930930
/// assert!(abs_difference <= f32::EPSILON);
931931
/// ```
932-
#[must_use]
932+
#[must_use = "method returns a new number and does not mutate the original value"]
933933
#[stable(feature = "rust1", since = "1.0.0")]
934934
#[inline]
935935
pub fn asinh(self) -> f32 {
@@ -954,7 +954,7 @@ impl f32 {
954954
///
955955
/// assert!(abs_difference <= f32::EPSILON);
956956
/// ```
957-
#[must_use]
957+
#[must_use = "method returns a new number and does not mutate the original value"]
958958
#[stable(feature = "rust1", since = "1.0.0")]
959959
#[inline]
960960
pub fn acosh(self) -> f32 {
@@ -978,7 +978,7 @@ impl f32 {
978978
///
979979
/// assert!(abs_difference <= 1e-5);
980980
/// ```
981-
#[must_use]
981+
#[must_use = "method returns a new number and does not mutate the original value"]
982982
#[stable(feature = "rust1", since = "1.0.0")]
983983
#[inline]
984984
pub fn atanh(self) -> f32 {

0 commit comments

Comments
 (0)