fix todo in Ord for Section

This commit is contained in:
steven-omaha
2023-02-01 17:24:57 +01:00
parent 031a9629fa
commit 0e8d942416
2 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ impl Pacdef {
Some((SYNC, _)) => self.install_packages(), Some((SYNC, _)) => self.install_packages(),
Some((UNMANAGED, _)) => Ok(self.show_unmanaged_packages()), Some((UNMANAGED, _)) => Ok(self.show_unmanaged_packages()),
Some((VERSION, _)) => Ok(self.show_version()), Some((VERSION, _)) => Ok(self.show_version()),
Some((_, _)) => todo!(), Some((_, _)) => panic!(),
None => { None => {
unreachable!("argument parser requires some subcommand to return an `ArgMatches`") unreachable!("argument parser requires some subcommand to return an `ArgMatches`")
} }
+7 -3
View File
@@ -9,7 +9,7 @@ use anyhow::{ensure, Context, Result};
use super::Package; use super::Package;
#[derive(Debug, Eq)] #[derive(Debug)]
pub struct Section { pub struct Section {
pub name: String, pub name: String,
pub packages: HashSet<Package>, pub packages: HashSet<Package>,
@@ -57,6 +57,10 @@ impl PartialEq for Section {
} }
} }
impl Eq for Section {
fn assert_receiver_is_total_eq(&self) {}
}
impl PartialOrd for Section { impl PartialOrd for Section {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.name.partial_cmp(&other.name) self.name.partial_cmp(&other.name)
@@ -64,8 +68,8 @@ impl PartialOrd for Section {
} }
impl Ord for Section { impl Ord for Section {
fn cmp(&self, _other: &Self) -> std::cmp::Ordering { fn cmp(&self, other: &Self) -> std::cmp::Ordering {
todo!() self.partial_cmp(other).unwrap()
} }
} }