fix todo in Ord for Section
This commit is contained in:
+1
-1
@@ -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`")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user