@@ -723,6 +723,7 @@ impl f32 {
723723 /// ```
724724 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
725725 #[ rustc_const_stable( feature = "const_float_classify" , since = "1.83.0" ) ]
726+ #[ must_use]
726727 pub const fn classify ( self ) -> FpCategory {
727728 // We used to have complicated logic here that avoids the simple bit-based tests to work
728729 // around buggy codegen for x87 targets (see
@@ -822,6 +823,7 @@ impl f32 {
822823 #[ doc( alias = "nextUp" ) ]
823824 #[ stable( feature = "float_next_up_down" , since = "1.86.0" ) ]
824825 #[ rustc_const_stable( feature = "float_next_up_down" , since = "1.86.0" ) ]
826+ #[ must_use = "method returns a new number and does not mutate the original value" ]
825827 pub const fn next_up ( self ) -> Self {
826828 // Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
827829 // denormals to zero. This is in general unsound and unsupported, but here
@@ -873,6 +875,7 @@ impl f32 {
873875 #[ doc( alias = "nextDown" ) ]
874876 #[ stable( feature = "float_next_up_down" , since = "1.86.0" ) ]
875877 #[ rustc_const_stable( feature = "float_next_up_down" , since = "1.86.0" ) ]
878+ #[ must_use = "method returns a new number and does not mutate the original value" ]
876879 pub const fn next_down ( self ) -> Self {
877880 // Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
878881 // denormals to zero. This is in general unsound and unsupported, but here
@@ -1089,6 +1092,8 @@ impl f32 {
10891092 #[ doc( alias = "average" ) ]
10901093 #[ stable( feature = "num_midpoint" , since = "1.85.0" ) ]
10911094 #[ rustc_const_stable( feature = "num_midpoint" , since = "1.85.0" ) ]
1095+ #[ must_use = "this returns the result of the operation, \
1096+ without modifying the original"]
10921097 pub const fn midpoint ( self , other : f32 ) -> f32 {
10931098 cfg_select ! {
10941099 // Allow faster implementation that have known good 64-bit float
0 commit comments