Skip to content

Commit

Permalink
Use new_static to create MIN and MAX
Browse files Browse the repository at this point in the history
  • Loading branch information
nakedible authored Oct 29, 2023
1 parent 97ed145 commit 3f6f4a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,11 @@ macro_rules! impl_ranged {
impl<const MIN: $internal, const MAX: $internal> $type<MIN, MAX> {
/// 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::<MIN>();

/// 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::<MAX>();

/// Expand the range that the value may be in. **Fails to compile** if the new range is
/// not a superset of the current range.
Expand Down

0 comments on commit 3f6f4a6

Please sign in to comment.