summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Woolcock <paul@woolcock.us>2020-09-25 16:32:26 -0400
committerPaul Woolcock <paul@woolcock.us>2020-09-25 16:44:06 -0400
commit5042d6685a8f15fa35b69266491515a6d4569927 (patch)
treea0d73c1b3b50515d8c9f541cc7919c705cf425b3
parent602bfb7cdd9e25a4447db6de7be90e973a88d93a (diff)
fix clippy, again
-rw-r--r--src/scopes.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/scopes.rs b/src/scopes.rs
index d39ed09..378b769 100644
--- a/src/scopes.rs
+++ b/src/scopes.rs
@@ -293,7 +293,7 @@ impl fmt::Display for Scopes {
/// Permission scope of the application.
/// [Details on what each permission provides][1]
/// [1]: https://github.com/tootsuite/documentation/blob/master/Using-the-API/OAuth-details.md)
-#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Hash, Serialize)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize)]
enum Scope {
/// Read only permissions.
#[serde(rename = "read")]
@@ -331,9 +331,9 @@ impl FromStr for Scope {
}
}
-impl Ord for Scope {
- fn cmp(&self, other: &Scope) -> Ordering {
- match (*self, *other) {
+impl PartialOrd for Scope {
+ fn partial_cmp(&self, other: &Scope) -> Option<Ordering> {
+ Some(match (*self, *other) {
(Scope::Read(None), Scope::Read(None)) => Ordering::Equal,
(Scope::Read(None), Scope::Read(Some(..))) => Ordering::Less,
(Scope::Read(Some(..)), Scope::Read(None)) => Ordering::Greater,
@@ -359,7 +359,13 @@ impl Ord for Scope {
(Scope::Push, Scope::Push) => Ordering::Equal,
(Scope::Push, _) => Ordering::Greater,
- }
+ })
+ }
+}
+
+impl Ord for Scope {
+ fn cmp(&self, other: &Scope) -> Ordering {
+ PartialOrd::partial_cmp(self, other).unwrap()
}
}