From: Simon Tatham Date: Sun, 24 Dec 2023 21:01:13 +0000 (+0000) Subject: Oh wait I don't need to _implement_ Eq X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=4f672f4b4901c92e0570e040d2d6b00d3146f0fe;p=mastodonochrome.git Oh wait I don't need to _implement_ Eq --- diff --git a/src/coloured_string.rs b/src/coloured_string.rs index 9f4ae85..9d21ec8 100644 --- a/src/coloured_string.rs +++ b/src/coloured_string.rs @@ -1,13 +1,13 @@ use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthChar; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct ColouredString { text: String, colour: String, } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct ColouredStringSlice<'a> { text: &'a str, colour: &'a str, @@ -70,22 +70,6 @@ impl<'a> ColouredStringSlice<'a> { pub fn text(&self) -> &'a str { &self.text } } -impl PartialEq for ColouredString { - fn eq(&self, rhs: &Self) -> bool { - self.text == rhs.text && self.colour == rhs.colour - } -} - -impl Eq for ColouredString {} - -impl<'a> PartialEq for ColouredStringSlice<'a> { - fn eq(&self, rhs: &ColouredStringSlice) -> bool { - self.text == rhs.text && self.colour == rhs.colour - } -} - -impl<'a> Eq for ColouredStringSlice<'a> {} - impl std::ops::Add for ColouredString { type Output = Self; fn add(self, rhs: Self) -> Self {