fix todo in Ord for Section

This commit is contained in:
Dr. Matthias Ratajczak
2023-02-01 17:24:57 +01:00
parent 54ace79cb5
commit 39475f133f
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((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`")
}
+7 -3
View File
@@ -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<Package>,
@@ -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<std::cmp::Ordering> {
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()
}
}