diff --git a/crates/gordian-lexicon/src/extra/objectid.rs b/crates/gordian-lexicon/src/extra/objectid.rs index 73cc00a..51c6d7f 100644 --- a/crates/gordian-lexicon/src/extra/objectid.rs +++ b/crates/gordian-lexicon/src/extra/objectid.rs @@ -1,4 +1,5 @@ use core::fmt; +use core::hash; use std::marker::PhantomData; use std::ops; use std::str::FromStr; @@ -9,16 +10,16 @@ use serde::de::Visitor; use serde::ser::SerializeSeq; #[doc(hidden)] -#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct Hex; -#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[doc(hidden)] pub struct Array; /// An object ID that can serialized as a hex-string or an array of integers. /// /// This only exists because knotserver uses both representations. -#[derive(Clone, Hash, Eq)] +#[derive(Clone, Eq)] pub struct ObjectId { inner: gix_hash::ObjectId, enc: PhantomData, @@ -49,6 +50,12 @@ impl Default for ObjectId { } } +impl hash::Hash for ObjectId { + fn hash(&self, state: &mut H) { + self.inner.hash(state); + } +} + impl PartialEq> for ObjectId { fn eq(&self, other: &ObjectId) -> bool { self.inner.eq(&other.inner) @@ -129,7 +136,7 @@ impl FromStr for ObjectId { } impl<'de> Visitor<'de> for Hex { - type Value = ObjectId; + type Value = ObjectId; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { formatter.write_str("commit hash") @@ -154,7 +161,7 @@ impl<'de> Deserialize<'de> for ObjectId { } impl<'de> Visitor<'de> for Array { - type Value = ObjectId; + type Value = ObjectId; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { formatter.write_str("commit hash") diff --git a/crates/gordian-lexicon/src/sh_tangled/knot.rs b/crates/gordian-lexicon/src/sh_tangled/knot.rs index 6500081..6113462 100644 --- a/crates/gordian-lexicon/src/sh_tangled/knot.rs +++ b/crates/gordian-lexicon/src/sh_tangled/knot.rs @@ -47,6 +47,7 @@ pub struct Member<'a> { } impl<'a> Member<'a> { + #[must_use] pub fn new(subject: &'a Did, domain: &'a str, created_at: OffsetDateTime) -> Self { Self { subject: subject.into(),