From 4f672f4b4901c92e0570e040d2d6b00d3146f0fe Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 24 Dec 2023 21:01:13 +0000 Subject: [PATCH] Oh wait I don't need to _implement_ Eq --- src/coloured_string.rs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) 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 { -- 2.30.2