Auto merge of #101959 - Xaeroxe:clamp-better-assert, r=ChrisDenton
Add better assert messages for f32/f64 clamps
This commit is contained in:
commit
3e565f1a27
2 changed files with 2 additions and 2 deletions
|
@ -1391,7 +1391,7 @@ impl f32 {
|
|||
#[stable(feature = "clamp", since = "1.50.0")]
|
||||
#[inline]
|
||||
pub fn clamp(mut self, min: f32, max: f32) -> f32 {
|
||||
assert!(min <= max);
|
||||
assert!(min <= max, "min > max, or either was NaN. min = {min:?}, max = {max:?}");
|
||||
if self < min {
|
||||
self = min;
|
||||
}
|
||||
|
|
|
@ -1389,7 +1389,7 @@ impl f64 {
|
|||
#[stable(feature = "clamp", since = "1.50.0")]
|
||||
#[inline]
|
||||
pub fn clamp(mut self, min: f64, max: f64) -> f64 {
|
||||
assert!(min <= max);
|
||||
assert!(min <= max, "min > max, or either was NaN. min = {min:?}, max = {max:?}");
|
||||
if self < min {
|
||||
self = min;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue