From e933f1efec4835b28d0bec0939e1fadf20c0604c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:45:44 +0100 Subject: [PATCH] Fix clippy: Explicitely implement PartialOrd This patch fixes `clippy::derive_ord_xor_partial_ord` by implementing PartialOrd manually instead of deriving it. Signed-off-by: Matthias Beyer --- src/scopes.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/scopes.rs b/src/scopes.rs index e7ff960..8af8865 100644 --- a/src/scopes.rs +++ b/src/scopes.rs @@ -264,7 +264,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")] @@ -302,6 +302,12 @@ impl FromStr for Scope { } } +impl PartialOrd for Scope { + fn partial_cmp(&self, other: &Scope) -> Option { + Some(self.cmp(other)) + } +} + impl Ord for Scope { fn cmp(&self, other: &Scope) -> Ordering { match (*self, *other) {