Skip to content

Commit

Permalink
Replace derived Debug implementation of salsa::Id
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Jul 22, 2024
1 parent 431fd14 commit fc3d39d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::Database;
/// You will rarely use the `Id` type directly, though you can.
/// You are more likely to use types that implement the `AsId` trait,
/// such as entity keys.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Id {
value: NonZeroU32,
}
Expand Down Expand Up @@ -42,6 +42,12 @@ impl Id {
}
}

impl Debug for Id {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.as_u32().fmt(f)
}
}

impl From<u32> for Id {
fn from(n: u32) -> Self {
Id::from_u32(n)
Expand Down

0 comments on commit fc3d39d

Please sign in to comment.