summaryrefslogtreecommitdiffstats
path: root/vendor/clap_builder/src/builder/debug_asserts.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/clap_builder/src/builder/debug_asserts.rs')
-rw-r--r--vendor/clap_builder/src/builder/debug_asserts.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/vendor/clap_builder/src/builder/debug_asserts.rs b/vendor/clap_builder/src/builder/debug_asserts.rs
index afc181c54..2b633849f 100644
--- a/vendor/clap_builder/src/builder/debug_asserts.rs
+++ b/vendor/clap_builder/src/builder/debug_asserts.rs
@@ -405,6 +405,12 @@ impl PartialEq for Flag<'_> {
impl PartialOrd for Flag<'_> {
fn partial_cmp(&self, other: &Flag) -> Option<Ordering> {
+ Some(self.cmp(other))
+ }
+}
+
+impl Ord for Flag<'_> {
+ fn cmp(&self, other: &Self) -> Ordering {
use Flag::*;
match (self, other) {
@@ -413,21 +419,15 @@ impl PartialOrd for Flag<'_> {
| (Command(s1, _), Arg(s2, _))
| (Arg(s1, _), Command(s2, _)) => {
if s1 == s2 {
- Some(Ordering::Equal)
+ Ordering::Equal
} else {
- s1.partial_cmp(s2)
+ s1.cmp(s2)
}
}
}
}
}
-impl Ord for Flag<'_> {
- fn cmp(&self, other: &Self) -> Ordering {
- self.partial_cmp(other).unwrap()
- }
-}
-
fn detect_duplicate_flags(flags: &[Flag], short_or_long: &str) {
use Flag::*;