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 <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2022-12-27 15:45:44 +01:00
parent e19070f935
commit e933f1efec
No known key found for this signature in database
1 changed files with 7 additions and 1 deletions

View File

@ -264,7 +264,7 @@ impl fmt::Display for Scopes {
/// Permission scope of the application. /// Permission scope of the application.
/// [Details on what each permission provides][1] /// [Details on what each permission provides][1]
/// [1]: https://github.com/tootsuite/documentation/blob/master/Using-the-API/OAuth-details.md) /// [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 { enum Scope {
/// Read only permissions. /// Read only permissions.
#[serde(rename = "read")] #[serde(rename = "read")]
@ -302,6 +302,12 @@ impl FromStr for Scope {
} }
} }
impl PartialOrd for Scope {
fn partial_cmp(&self, other: &Scope) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for Scope { impl Ord for Scope {
fn cmp(&self, other: &Scope) -> Ordering { fn cmp(&self, other: &Scope) -> Ordering {
match (*self, *other) { match (*self, *other) {