Skip to content

Commit

Permalink
Fix weird implementation of *Id::default (serenity-rs#2684)
Browse files Browse the repository at this point in the history
This changes the implementation of `Default` to just use `NonZeroU64::MIN`.
  • Loading branch information
GnomedDev authored Jan 2, 2024
1 parent 47011ce commit 9787f8f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/model/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ macro_rules! id_u64 {

impl Default for $name {
fn default() -> Self {
// Have the possible panic at compile time. `unwrap()` is not const-stable
const ONE: NonZeroU64 = match NonZeroU64::new(1) {
Some(x) => x,
None => unreachable!(),
};
Self(ONE)
Self(NonZeroU64::MIN)
}
}

Expand Down

0 comments on commit 9787f8f

Please sign in to comment.