mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 08:23:04 +03:00
Enable clippy::derive_ord_xor_partial_ord
(#9371)
This PR enables the [`clippy::derive_ord_xor_partial_ord`](https://rust-lang.github.io/rust-clippy/master/index.html#/derive_ord_xor_partial_ord) rule and fixes the outstanding violations. Release Notes: - N/A
This commit is contained in:
parent
35c9216ed7
commit
4939d23bd3
@ -411,7 +411,6 @@ style = "allow"
|
|||||||
almost_complete_range = "allow"
|
almost_complete_range = "allow"
|
||||||
arc_with_non_send_sync = "allow"
|
arc_with_non_send_sync = "allow"
|
||||||
borrowed_box = "allow"
|
borrowed_box = "allow"
|
||||||
derive_ord_xor_partial_ord = "allow"
|
|
||||||
let_underscore_future = "allow"
|
let_underscore_future = "allow"
|
||||||
map_entry = "allow"
|
map_entry = "allow"
|
||||||
non_canonical_clone_impl = "allow"
|
non_canonical_clone_impl = "allow"
|
||||||
|
@ -49,7 +49,7 @@ pub trait PromptTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[repr(i8)]
|
#[repr(i8)]
|
||||||
#[derive(PartialEq, Eq, Ord)]
|
#[derive(PartialEq, Eq)]
|
||||||
pub enum PromptPriority {
|
pub enum PromptPriority {
|
||||||
/// Ignores truncation.
|
/// Ignores truncation.
|
||||||
Mandatory,
|
Mandatory,
|
||||||
@ -59,11 +59,17 @@ pub enum PromptPriority {
|
|||||||
|
|
||||||
impl PartialOrd for PromptPriority {
|
impl PartialOrd for PromptPriority {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||||
|
Some(self.cmp(other))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Ord for PromptPriority {
|
||||||
|
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
||||||
match (self, other) {
|
match (self, other) {
|
||||||
(Self::Mandatory, Self::Mandatory) => Some(std::cmp::Ordering::Equal),
|
(Self::Mandatory, Self::Mandatory) => std::cmp::Ordering::Equal,
|
||||||
(Self::Mandatory, Self::Ordered { .. }) => Some(std::cmp::Ordering::Greater),
|
(Self::Mandatory, Self::Ordered { .. }) => std::cmp::Ordering::Greater,
|
||||||
(Self::Ordered { .. }, Self::Mandatory) => Some(std::cmp::Ordering::Less),
|
(Self::Ordered { .. }, Self::Mandatory) => std::cmp::Ordering::Less,
|
||||||
(Self::Ordered { order: a }, Self::Ordered { order: b }) => b.partial_cmp(a),
|
(Self::Ordered { order: a }, Self::Ordered { order: b }) => b.cmp(a),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user