diff --git a/execution/block-partitioner/src/v2/types.rs b/execution/block-partitioner/src/v2/types.rs index b7c10b23bcc16..66d63fb831f15 100644 --- a/execution/block-partitioner/src/v2/types.rs +++ b/execution/block-partitioner/src/v2/types.rs @@ -20,10 +20,9 @@ impl Ord for SubBlockIdx { } } -#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for SubBlockIdx { fn partial_cmp(&self, other: &Self) -> Option { - (self.round_id, self.shard_id).partial_cmp(&(other.round_id, other.shard_id)) + Some(self.cmp(other)) } } @@ -69,11 +68,9 @@ impl Ord for ShardedTxnIndexV2 { } } -#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for ShardedTxnIndexV2 { fn partial_cmp(&self, other: &Self) -> Option { - (self.sub_block_idx, self.pre_partitioned_txn_idx) - .partial_cmp(&(other.sub_block_idx, other.pre_partitioned_txn_idx)) + Some(self.cmp(other)) } } diff --git a/storage/backup/backup-cli/src/metadata/mod.rs b/storage/backup/backup-cli/src/metadata/mod.rs index e2eb7a51665d9..9b8c9cca973a1 100644 --- a/storage/backup/backup-cli/src/metadata/mod.rs +++ b/storage/backup/backup-cli/src/metadata/mod.rs @@ -225,10 +225,9 @@ impl PartialEq for CompactionTimestampsMeta { } } -#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for CompactionTimestampsMeta { fn partial_cmp(&self, other: &Self) -> Option { - self.file_compacted_at.partial_cmp(&other.file_compacted_at) + Some(self.cmp(other)) } } diff --git a/third_party/move/move-analyzer/src/symbols.rs b/third_party/move/move-analyzer/src/symbols.rs index 2bde3ddb0dcef..ef2043246bc28 100644 --- a/third_party/move/move-analyzer/src/symbols.rs +++ b/third_party/move/move-analyzer/src/symbols.rs @@ -1,7 +1,6 @@ // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 -#![allow(clippy::unwrap_or_default)] #![allow(clippy::non_canonical_partial_ord_impl)] //! This module is responsible for building symbolication information on top of compiler's typed @@ -171,12 +170,13 @@ struct StructDef { field_defs: Vec, } -#[derive(Derivative, Debug, Clone, PartialEq, Eq)] -#[derivative(PartialOrd, Ord)] +#[derive(Derivative)] +#[derivative(Debug, Clone, Eq, PartialEq, PartialOrd, Ord)] pub struct FunctionDef { name: Symbol, start: Position, attrs: Vec, + #[derivative(PartialEq = "ignore")] #[derivative(PartialOrd = "ignore")] #[derivative(Ord = "ignore")] ident_type: IdentType, @@ -525,10 +525,7 @@ impl UseDef { col_end, }; - references - .entry(def_loc) - .or_insert_with(BTreeSet::new) - .insert(use_loc); + references.entry(def_loc).or_default().insert(use_loc); Self { col_start: use_start.character, col_end, @@ -564,7 +561,7 @@ impl UseDefMap { } fn insert(&mut self, key: u32, val: UseDef) { - self.0.entry(key).or_insert_with(BTreeSet::new).insert(val); + self.0.entry(key).or_default().insert(val); } fn get(&self, key: u32) -> Option> { @@ -597,10 +594,7 @@ impl FunctionIdentTypeMap { impl Symbols { pub fn merge(&mut self, other: Self) { for (k, v) in other.references { - self.references - .entry(k) - .or_insert_with(BTreeSet::new) - .extend(v); + self.references.entry(k).or_default().extend(v); } self.file_use_defs.extend(other.file_use_defs); self.file_name_mapping.extend(other.file_name_mapping); diff --git a/third_party/move/move-borrow-graph/src/references.rs b/third_party/move/move-borrow-graph/src/references.rs index 6461386c739d4..9f9798b1e475c 100644 --- a/third_party/move/move-borrow-graph/src/references.rs +++ b/third_party/move/move-borrow-graph/src/references.rs @@ -209,10 +209,9 @@ impl PartialEq for BorrowEdge { impl Eq for BorrowEdge {} -#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for BorrowEdge { fn partial_cmp(&self, other: &BorrowEdge) -> Option { - BorrowEdgeNoLoc::new(self).partial_cmp(&BorrowEdgeNoLoc::new(other)) + Some(self.cmp(other)) } } diff --git a/third_party/move/move-compiler/src/shared/unique_set.rs b/third_party/move/move-compiler/src/shared/unique_set.rs index d930eae1cda03..3337be0f66c6c 100644 --- a/third_party/move/move-compiler/src/shared/unique_set.rs +++ b/third_party/move/move-compiler/src/shared/unique_set.rs @@ -118,10 +118,9 @@ impl PartialEq for UniqueSet { } impl Eq for UniqueSet {} -#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for UniqueSet { fn partial_cmp(&self, other: &UniqueSet) -> Option { - (self.0).0.keys().partial_cmp((other.0).0.keys()) + Some(self.cmp(other)) } } diff --git a/third_party/move/move-core/types/src/gas_algebra.rs b/third_party/move/move-core/types/src/gas_algebra.rs index 44cc44ab0752e..d64a084724820 100644 --- a/third_party/move/move-core/types/src/gas_algebra.rs +++ b/third_party/move/move-core/types/src/gas_algebra.rs @@ -179,10 +179,9 @@ impl PartialEq for GasQuantity { impl Eq for GasQuantity {} -#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for GasQuantity { fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp_impl(other)) + Some(self.cmp(other)) } }