FileFinder: use idiomatic definition for Ord/PartialOrd (#6851)
This commit is contained in:
parent
536a4ab87a
commit
1f83b5c508
1 changed files with 13 additions and 15 deletions
|
@ -156,13 +156,6 @@ struct ProjectPanelOrdMatch(PathMatch);
|
|||
|
||||
impl Ord for ProjectPanelOrdMatch {
|
||||
fn cmp(&self, other: &Self) -> cmp::Ordering {
|
||||
self.partial_cmp(other).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for ProjectPanelOrdMatch {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
||||
Some(
|
||||
self.0
|
||||
.score
|
||||
.partial_cmp(&other.0.score)
|
||||
|
@ -174,8 +167,13 @@ impl PartialOrd for ProjectPanelOrdMatch {
|
|||
.distance_to_relative_ancestor
|
||||
.cmp(&self.0.distance_to_relative_ancestor)
|
||||
})
|
||||
.then_with(|| self.0.path.cmp(&other.0.path).reverse()),
|
||||
)
|
||||
.then_with(|| self.0.path.cmp(&other.0.path).reverse())
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for ProjectPanelOrdMatch {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue