From 3f6f4a68a74f6c4ab461cb3ac0c7e36b598c6837 Mon Sep 17 00:00:00 2001 From: Nuutti Kotivuori Date: Sun, 29 Oct 2023 13:39:12 +0000 Subject: [PATCH] Use `new_static` to create `MIN` and `MAX` --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 441dacb..44798c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -310,11 +310,11 @@ macro_rules! impl_ranged { impl $type { /// The smallest value that can be represented by this type. // Safety: `MIN` is in range by definition. - pub const MIN: Self = unsafe { Self::new_unchecked(MIN) }; + pub const MIN: Self = Self::new_static::(); /// The largest value that can be represented by this type. // Safety: `MAX` is in range by definition. - pub const MAX: Self = unsafe { Self::new_unchecked(MAX) }; + pub const MAX: Self = Self::new_static::(); /// Expand the range that the value may be in. **Fails to compile** if the new range is /// not a superset of the current range.