Skip to content

Commit ee4bbf8

Browse files
committed
Make assert messages consistent with field names
1 parent aeb4276 commit ee4bbf8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

library/core/src/cmp/clamp.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ macro impl_for_float($t:ty) {
6767
#[rustc_const_unstable(feature = "clamp_bounds", issue = "147781")]
6868
impl const ClampBounds<$t> for RangeFrom<$t> {
6969
fn clamp(self, value: $t) -> $t {
70-
assert!(!self.start.is_nan(), "min was NaN");
70+
assert!(!self.start.is_nan(), "start was NaN");
7171
value.max(self.start)
7272
}
7373
}
@@ -76,7 +76,7 @@ macro impl_for_float($t:ty) {
7676
#[rustc_const_unstable(feature = "clamp_bounds", issue = "147781")]
7777
impl const ClampBounds<$t> for RangeToInclusive<$t> {
7878
fn clamp(self, value: $t) -> $t {
79-
assert!(!self.end.is_nan(), "max was NaN");
79+
assert!(!self.end.is_nan(), "end was NaN");
8080
value.min(self.end)
8181
}
8282
}
@@ -86,6 +86,7 @@ macro impl_for_float($t:ty) {
8686
impl const ClampBounds<$t> for RangeInclusive<$t> {
8787
fn clamp(self, value: $t) -> $t {
8888
let (start, end) = self.into_inner();
89+
assert!(start <= end, "start > end, or either was NaN");
8990
value.clamp(start, end)
9091
}
9192
}

0 commit comments

Comments
 (0)