Skip to content

Commit 54cb728

Browse files
author
Kyle Strand
committed
Let 'clamp' be invoked without using return value; used in tests
1 parent c5b0003 commit 54cb728

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Diff for: src/libstd/f32.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,8 @@ 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-
#[must_use = "method returns a new number and does not mutate the original value"]
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"]
10191020
#[unstable(feature = "clamp", issue = "44095")]
10201021
#[inline]
10211022
pub fn clamp(self, min: f32, max: f32) -> f32 {

Diff for: src/libstd/f64.rs

+2
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,8 @@ 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"]
939941
#[unstable(feature = "clamp", issue = "44095")]
940942
#[inline]
941943
pub fn clamp(self, min: f64, max: f64) -> f64 {

0 commit comments

Comments
 (0)