Skip to content

Commit fcb2c3d

Browse files
committed
clippy: canonical partial_cmp implementations
1 parent bb88c18 commit fcb2c3d

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

src/descriptor/tr.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@ impl<Pk: MiniscriptKey, Ext: Extension> Eq for Tr<Pk, Ext> {}
8787

8888
impl<Pk: MiniscriptKey, Ext: Extension> PartialOrd for Tr<Pk, Ext> {
8989
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
90-
match self.internal_key.partial_cmp(&other.internal_key) {
91-
Some(cmp::Ordering::Equal) => {}
92-
ord => return ord,
93-
}
94-
self.tree.partial_cmp(&other.tree)
90+
Some(self.cmp(other))
9591
}
9692
}
9793

src/extensions/param.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ impl CovExtArgs {
132132

133133
impl PartialOrd for CovExtArgs {
134134
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
135-
// HACKY implementation, need Ord/PartialOrd to make it work with other components
136-
// in the library
137-
self.to_string().partial_cmp(&other.to_string())
135+
Some(self.cmp(other))
138136
}
139137
}
140138

src/policy/compiler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl Eq for OrdF64 {}
3434
// to derive both or neither. Better to be explicit.
3535
impl PartialOrd for OrdF64 {
3636
fn partial_cmp(&self, other: &OrdF64) -> Option<cmp::Ordering> {
37-
self.0.partial_cmp(&other.0)
37+
Some(self.cmp(other))
3838
}
3939
}
4040
impl Ord for OrdF64 {

0 commit comments

Comments
 (0)