diff --git a/src/setting.rs b/src/setting.rs index ce899c4..b1e9453 100644 --- a/src/setting.rs +++ b/src/setting.rs @@ -2,23 +2,15 @@ use super::{tag_from_bytes, tag_from_str_lossy, Tag}; use core::fmt; /// Setting combining a tag and a value for features and variations. -#[derive(Copy, Clone, Default, Debug)] -pub struct Setting { +#[derive(Copy, Clone, Default, Debug, PartialEq, Eq)] +pub struct Setting { /// The tag that identifies the setting. pub tag: Tag, /// The value for the setting. pub value: T, } -impl PartialEq for Setting { - fn eq(&self, other: &Self) -> bool { - self.tag == other.tag && self.value == other.value - } -} - -impl Eq for Setting {} - -impl fmt::Display for Setting { +impl fmt::Display for Setting { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let bytes = self.tag.to_be_bytes(); let tag_name = core::str::from_utf8(&bytes).unwrap_or(""); @@ -74,7 +66,7 @@ impl Setting { } } -impl From<(Tag, T)> for Setting { +impl From<(Tag, T)> for Setting { fn from(v: (Tag, T)) -> Self { Self { tag: v.0, @@ -110,7 +102,7 @@ impl From<&(&[u8; 4], T)> for Setting { } } -impl From<(&str, T)> for Setting { +impl From<(&str, T)> for Setting { fn from(v: (&str, T)) -> Self { Self { tag: tag_from_str_lossy(v.0),