diff --git a/crates/domain/src/id.rs b/crates/domain/src/id.rs index 382c249..648e315 100644 --- a/crates/domain/src/id.rs +++ b/crates/domain/src/id.rs @@ -13,6 +13,7 @@ pub struct OrgId(Uuid); impl OrgId { /// Generate a fresh random id. + #[must_use = "generating an OrgId and discarding it is almost certainly a mistake"] pub fn new() -> Self { Self(Uuid::new_v4()) } @@ -22,8 +23,8 @@ impl OrgId { Self(uuid) } - /// The underlying [`Uuid`]. - pub fn as_uuid(&self) -> Uuid { + /// Return the underlying [`Uuid`]. + pub fn to_uuid(&self) -> Uuid { self.0 } } @@ -36,7 +37,7 @@ impl Default for OrgId { impl fmt::Display for OrgId { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", self.0) + fmt::Display::fmt(&self.0, f) } }