From 0e8d942416ad4b41455a6c2621c89cf3f6cf2557 Mon Sep 17 00:00:00 2001 From: steven-omaha <35634100+steven-omaha@users.noreply.github.com> Date: Wed, 1 Feb 2023 17:24:57 +0100 Subject: [PATCH] fix todo in Ord for Section --- src/core.rs | 2 +- src/grouping/section.rs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core.rs b/src/core.rs index 446a939..83c2b32 100644 --- a/src/core.rs +++ b/src/core.rs @@ -52,7 +52,7 @@ impl Pacdef { Some((SYNC, _)) => self.install_packages(), Some((UNMANAGED, _)) => Ok(self.show_unmanaged_packages()), Some((VERSION, _)) => Ok(self.show_version()), - Some((_, _)) => todo!(), + Some((_, _)) => panic!(), None => { unreachable!("argument parser requires some subcommand to return an `ArgMatches`") } diff --git a/src/grouping/section.rs b/src/grouping/section.rs index bccc165..b74401f 100644 --- a/src/grouping/section.rs +++ b/src/grouping/section.rs @@ -9,7 +9,7 @@ use anyhow::{ensure, Context, Result}; use super::Package; -#[derive(Debug, Eq)] +#[derive(Debug)] pub struct Section { pub name: String, pub packages: HashSet, @@ -57,6 +57,10 @@ impl PartialEq for Section { } } +impl Eq for Section { + fn assert_receiver_is_total_eq(&self) {} +} + impl PartialOrd for Section { fn partial_cmp(&self, other: &Self) -> Option { self.name.partial_cmp(&other.name) @@ -64,8 +68,8 @@ impl PartialOrd for Section { } impl Ord for Section { - fn cmp(&self, _other: &Self) -> std::cmp::Ordering { - todo!() + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.partial_cmp(other).unwrap() } }