Skip to content

Commit

Permalink
Ignore "non_canonical_partial_ord_impl" for some clippy warnings.
Browse files Browse the repository at this point in the history
The Ord implementation is just unwrapping the PartialOrd implementation, so this is essentially fine. Comparing floats is already not okay, but we need this to be Ord, so the unwrap is the cost.
  • Loading branch information
andriyDev committed Jun 23, 2024
1 parent fe3677c commit 0e98b68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/astar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ impl PartialEq for NodeRef {

impl Eq for NodeRef {}

// Since we are comparing floats which are not Ord, it is more meaningful to
// impl PartialOrd, then unwrap in Ord.
#[allow(clippy::non_canonical_partial_ord_impl)]
impl PartialOrd for NodeRef {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
match self.estimate.partial_cmp(&other.estimate) {
Expand Down
3 changes: 3 additions & 0 deletions src/avoidance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ fn nav_mesh_borders_to_dodgy_obstacles(
}
}
impl Eq for ExploreNode {}
// Since we are comparing floats which are not Ord, it is more meaningful to
// impl PartialOrd, then unwrap in Ord.
#[allow(clippy::non_canonical_partial_ord_impl)]
impl PartialOrd for ExploreNode {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
other.score.partial_cmp(&self.score)
Expand Down

0 comments on commit 0e98b68

Please sign in to comment.