File tree 2 files changed +8
-10
lines changed
2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -1015,8 +1015,7 @@ impl f32 {
1015
1015
/// assert!((2.0f32).clamp(-2.0, 1.0) == 1.0);
1016
1016
/// assert!((std::f32::NAN).clamp(-2.0, 1.0).is_nan());
1017
1017
/// ```
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" ]
1020
1019
#[ unstable( feature = "clamp" , issue = "44095" ) ]
1021
1020
#[ inline]
1022
1021
pub fn clamp ( self , min : f32 , max : f32 ) -> f32 {
@@ -1631,18 +1630,18 @@ mod tests {
1631
1630
#[ test]
1632
1631
#[ should_panic]
1633
1632
fn test_clamp_min_greater_than_max ( ) {
1634
- 1.0f32 . clamp ( 3.0 , 1.0 ) ;
1633
+ let _ = 1.0f32 . clamp ( 3.0 , 1.0 ) ;
1635
1634
}
1636
1635
1637
1636
#[ test]
1638
1637
#[ should_panic]
1639
1638
fn test_clamp_min_is_nan ( ) {
1640
- 1.0f32 . clamp ( NAN , 1.0 ) ;
1639
+ let _ = 1.0f32 . clamp ( NAN , 1.0 ) ;
1641
1640
}
1642
1641
1643
1642
#[ test]
1644
1643
#[ should_panic]
1645
1644
fn test_clamp_max_is_nan ( ) {
1646
- 1.0f32 . clamp ( 3.0 , NAN ) ;
1645
+ let _ = 1.0f32 . clamp ( 3.0 , NAN ) ;
1647
1646
}
1648
1647
}
Original file line number Diff line number Diff line change @@ -936,8 +936,7 @@ impl f64 {
936
936
/// assert!((2.0f64).clamp(-2.0, 1.0) == 1.0);
937
937
/// assert!((std::f64::NAN).clamp(-2.0, 1.0).is_nan());
938
938
/// ```
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" ]
941
940
#[ unstable( feature = "clamp" , issue = "44095" ) ]
942
941
#[ inline]
943
942
pub fn clamp ( self , min : f64 , max : f64 ) -> f64 {
@@ -1571,18 +1570,18 @@ mod tests {
1571
1570
#[ test]
1572
1571
#[ should_panic]
1573
1572
fn test_clamp_min_greater_than_max ( ) {
1574
- 1.0f64 . clamp ( 3.0 , 1.0 ) ;
1573
+ let _ = 1.0f64 . clamp ( 3.0 , 1.0 ) ;
1575
1574
}
1576
1575
1577
1576
#[ test]
1578
1577
#[ should_panic]
1579
1578
fn test_clamp_min_is_nan ( ) {
1580
- 1.0f64 . clamp ( NAN , 1.0 ) ;
1579
+ let _ = 1.0f64 . clamp ( NAN , 1.0 ) ;
1581
1580
}
1582
1581
1583
1582
#[ test]
1584
1583
#[ should_panic]
1585
1584
fn test_clamp_max_is_nan ( ) {
1586
- 1.0f64 . clamp ( 3.0 , NAN ) ;
1585
+ let _ = 1.0f64 . clamp ( 3.0 , NAN ) ;
1587
1586
}
1588
1587
}
You can’t perform that action at this time.
0 commit comments