From 1530f6375691355576e502a62d449720a819ce43 Mon Sep 17 00:00:00 2001 From: konsti219 <37149441+konsti219@users.noreply.github.com> Date: Sun, 7 May 2023 00:31:25 +0200 Subject: [PATCH] Use `cmp` of Self in implementaions of `partial_cmp` (#8559) # Objective Ensure future consistency between the two compare functions for all types with manual `Ord` and `PartialOrd` implementations. ## Solution Use `Self::cpm` in the implementation of `partial_cpm` for types `Handle` and `Name`. --- crates/bevy_asset/src/handle.rs | 2 +- crates/bevy_core/src/name.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_asset/src/handle.rs b/crates/bevy_asset/src/handle.rs index d37eebca71..4921e97e44 100644 --- a/crates/bevy_asset/src/handle.rs +++ b/crates/bevy_asset/src/handle.rs @@ -279,7 +279,7 @@ impl Eq for Handle {} impl PartialOrd for Handle { fn partial_cmp(&self, other: &Self) -> Option { - Some(self.id.cmp(&other.id)) + Some(self.cmp(other)) } } diff --git a/crates/bevy_core/src/name.rs b/crates/bevy_core/src/name.rs index 32216cb280..bf60647f0f 100644 --- a/crates/bevy_core/src/name.rs +++ b/crates/bevy_core/src/name.rs @@ -177,7 +177,7 @@ impl Eq for Name {} impl PartialOrd for Name { fn partial_cmp(&self, other: &Self) -> Option { - self.name.partial_cmp(&other.name) + Some(self.cmp(other)) } }