mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-10 13:56:48 +00:00
Fix bad partial ord implementation
This commit is contained in:
parent
8fc4fa6f10
commit
48ae6611f6
@ -71,19 +71,20 @@ impl PartialEq for ComponentInfo {
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for ComponentInfo {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
|
||||
self.priority.partial_cmp(&other.priority)
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for ComponentInfo {}
|
||||
|
||||
impl Ord for ComponentInfo {
|
||||
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
|
||||
self.priority.cmp(&other.priority)
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for ComponentInfo {
|
||||
fn partial_cmp(&self, other: &ComponentInfo) -> Option<core::cmp::Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for ComponentInfo {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
f.debug_struct("ComponentInfo")
|
||||
|
@ -185,18 +185,18 @@ impl<T: ?Sized> PartialEq for KeyableArc<T> {
|
||||
|
||||
impl<T: ?Sized> Eq for KeyableArc<T> {}
|
||||
|
||||
impl<T: ?Sized> PartialOrd for KeyableArc<T> {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(Arc::as_ptr(&self.0).cmp(&Arc::as_ptr(&other.0)))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> Ord for KeyableArc<T> {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
Arc::as_ptr(&self.0).cmp(&Arc::as_ptr(&other.0))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> PartialOrd for KeyableArc<T> {
|
||||
fn partial_cmp(&self, other: &KeyableArc<T>) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> Hash for KeyableArc<T> {
|
||||
fn hash<H: Hasher>(&self, s: &mut H) {
|
||||
Arc::as_ptr(&self.0).hash(s)
|
||||
@ -275,18 +275,18 @@ impl<T: ?Sized> PartialEq for KeyableWeak<T> {
|
||||
|
||||
impl<T: ?Sized> Eq for KeyableWeak<T> {}
|
||||
|
||||
impl<T: ?Sized> PartialOrd for KeyableWeak<T> {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(self.0.as_ptr().cmp(&other.0.as_ptr()))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> Ord for KeyableWeak<T> {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
self.0.as_ptr().cmp(&other.0.as_ptr())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> PartialOrd for KeyableWeak<T> {
|
||||
fn partial_cmp(&self, other: &KeyableWeak<T>) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> Hash for KeyableWeak<T> {
|
||||
fn hash<H: Hasher>(&self, s: &mut H) {
|
||||
self.0.as_ptr().hash(s)
|
||||
|
Loading…
x
Reference in New Issue
Block a user