Let 'clamp' be invoked without using return value; used in tests

This commit is contained in:
Kyle Strand 2019-08-28 12:04:32 -06:00
parent c5b0003d99
commit 54cb728ab8
2 changed files with 4 additions and 1 deletions

View file

@ -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 {

View file

@ -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 {