diff options
-rw-r--r-- | examples/lazy/src/main.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/lazy/src/main.rs b/examples/lazy/src/main.rs index 63c282d3..818c91bc 100644 --- a/examples/lazy/src/main.rs +++ b/examples/lazy/src/main.rs @@ -86,7 +86,7 @@ impl From<Color> for iced::Color { } } -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, Eq)] struct Item { name: String, color: Color, @@ -98,6 +98,12 @@ impl Hash for Item { } } +impl PartialEq for Item { + fn eq(&self, other: &Self) -> bool { + self.name.eq(&other.name) + } +} + impl From<&str> for Item { fn from(s: &str) -> Self { Self { @@ -166,10 +172,10 @@ impl Sandbox for App { items.sort_by(|a, b| match self.order { Order::Ascending => { - (&a.name).to_lowercase().cmp(&(&b.name).to_lowercase()) + a.name.to_lowercase().cmp(&b.name.to_lowercase()) } Order::Descending => { - (&b.name).to_lowercase().cmp(&(&a.name).to_lowercase()) + b.name.to_lowercase().cmp(&a.name.to_lowercase()) } }); |