about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorKyle Strand <kyle.strand@rms.com>2019-08-28 12:04:32 -0600
committerKyle Strand <kyle.strand@rms.com>2019-08-28 12:04:32 -0600
commit54cb728ab8b89ef31578455031519101a93dadc7 (patch)
tree3af29d81eb4be0879d25e1c5318c193d562afeef /src/libstd
parentc5b0003d9948ac302631f83e2addfa51db6ac601 (diff)
downloadrust-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.rs3
-rw-r--r--src/libstd/f64.rs2
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 {