File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -1015,8 +1015,7 @@ impl f32 {
10151015 /// assert!((2.0f32).clamp(-2.0, 1.0) == 1.0);
10161016 /// assert!((std::f32::NAN).clamp(-2.0, 1.0).is_nan());
10171017 /// ```
1018- // The tests below invoke `clamp` without a return value in order to cause a `panic`.
1019- // #[must_use = "method returns a new number and does not mutate the original value"]
1018+ #[ must_use = "method returns a new number and does not mutate the original value" ]
10201019 #[ unstable( feature = "clamp" , issue = "44095" ) ]
10211020 #[ inline]
10221021 pub fn clamp ( self , min : f32 , max : f32 ) -> f32 {
@@ -1631,18 +1630,18 @@ mod tests {
16311630 #[ test]
16321631 #[ should_panic]
16331632 fn test_clamp_min_greater_than_max ( ) {
1634- 1.0f32 . clamp ( 3.0 , 1.0 ) ;
1633+ let _ = 1.0f32 . clamp ( 3.0 , 1.0 ) ;
16351634 }
16361635
16371636 #[ test]
16381637 #[ should_panic]
16391638 fn test_clamp_min_is_nan ( ) {
1640- 1.0f32 . clamp ( NAN , 1.0 ) ;
1639+ let _ = 1.0f32 . clamp ( NAN , 1.0 ) ;
16411640 }
16421641
16431642 #[ test]
16441643 #[ should_panic]
16451644 fn test_clamp_max_is_nan ( ) {
1646- 1.0f32 . clamp ( 3.0 , NAN ) ;
1645+ let _ = 1.0f32 . clamp ( 3.0 , NAN ) ;
16471646 }
16481647}
Original file line number Diff line number Diff line change @@ -936,8 +936,7 @@ impl f64 {
936936 /// assert!((2.0f64).clamp(-2.0, 1.0) == 1.0);
937937 /// assert!((std::f64::NAN).clamp(-2.0, 1.0).is_nan());
938938 /// ```
939- // The tests below invoke `clamp` without a return value in order to cause a `panic`.
940- // #[must_use = "method returns a new number and does not mutate the original value"]
939+ #[ must_use = "method returns a new number and does not mutate the original value" ]
941940 #[ unstable( feature = "clamp" , issue = "44095" ) ]
942941 #[ inline]
943942 pub fn clamp ( self , min : f64 , max : f64 ) -> f64 {
@@ -1571,18 +1570,18 @@ mod tests {
15711570 #[ test]
15721571 #[ should_panic]
15731572 fn test_clamp_min_greater_than_max ( ) {
1574- 1.0f64 . clamp ( 3.0 , 1.0 ) ;
1573+ let _ = 1.0f64 . clamp ( 3.0 , 1.0 ) ;
15751574 }
15761575
15771576 #[ test]
15781577 #[ should_panic]
15791578 fn test_clamp_min_is_nan ( ) {
1580- 1.0f64 . clamp ( NAN , 1.0 ) ;
1579+ let _ = 1.0f64 . clamp ( NAN , 1.0 ) ;
15811580 }
15821581
15831582 #[ test]
15841583 #[ should_panic]
15851584 fn test_clamp_max_is_nan ( ) {
1586- 1.0f64 . clamp ( 3.0 , NAN ) ;
1585+ let _ = 1.0f64 . clamp ( 3.0 , NAN ) ;
15871586 }
15881587}
You can’t perform that action at this time.
0 commit comments