diff options
| author | Kyle Strand <kyle.strand@rms.com> | 2019-08-28 12:04:32 -0600 |
|---|---|---|
| committer | Kyle Strand <kyle.strand@rms.com> | 2019-08-28 12:04:32 -0600 |
| commit | 54cb728ab8b89ef31578455031519101a93dadc7 (patch) | |
| tree | 3af29d81eb4be0879d25e1c5318c193d562afeef /src/libstd | |
| parent | c5b0003d9948ac302631f83e2addfa51db6ac601 (diff) | |
| download | rust-54cb728ab8b89ef31578455031519101a93dadc7.tar.gz rust-54cb728ab8b89ef31578455031519101a93dadc7.zip | |
Let 'clamp' be invoked without using return value; used in tests
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/f32.rs | 3 | ||||
| -rw-r--r-- | src/libstd/f64.rs | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 142558a9f0a..aefe4690b10 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -1015,7 +1015,8 @@ impl f32 { /// assert!((2.0f32).clamp(-2.0, 1.0) == 1.0); /// assert!((std::f32::NAN).clamp(-2.0, 1.0).is_nan()); /// ``` - #[must_use = "method returns a new number and does not mutate the original value"] + // The tests below invoke `clamp` without a return value in order to cause a `panic`. + // #[must_use = "method returns a new number and does not mutate the original value"] #[unstable(feature = "clamp", issue = "44095")] #[inline] pub fn clamp(self, min: f32, max: f32) -> f32 { diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index d46cef149f1..0eca1434a63 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -936,6 +936,8 @@ impl f64 { /// assert!((2.0f64).clamp(-2.0, 1.0) == 1.0); /// assert!((std::f64::NAN).clamp(-2.0, 1.0).is_nan()); /// ``` + // The tests below invoke `clamp` without a return value in order to cause a `panic`. + // #[must_use = "method returns a new number and does not mutate the original value"] #[unstable(feature = "clamp", issue = "44095")] #[inline] pub fn clamp(self, min: f64, max: f64) -> f64 { |
