From 939a5edf3d28acfc390eedc46eab69843ba363b6 Mon Sep 17 00:00:00 2001 From: Andrew Tunnell-Jones Date: Fri, 24 Jan 2020 05:06:00 +1100 Subject: [PATCH] Fix reversed arguments in PartialOrd impls (#358) --- src/bytes.rs | 12 ++++++------ src/bytes_mut.rs | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/bytes.rs b/src/bytes.rs index 35a3c75..0ca6138 100644 --- a/src/bytes.rs +++ b/src/bytes.rs @@ -626,7 +626,7 @@ impl PartialEq for [u8] { impl PartialOrd for [u8] { fn partial_cmp(&self, other: &Bytes) -> Option { - other.partial_cmp(self) + <[u8] as PartialOrd<[u8]>>::partial_cmp(self, other) } } @@ -650,7 +650,7 @@ impl PartialEq for str { impl PartialOrd for str { fn partial_cmp(&self, other: &Bytes) -> Option { - other.partial_cmp(self) + <[u8] as PartialOrd<[u8]>>::partial_cmp(self.as_bytes(), other) } } @@ -674,7 +674,7 @@ impl PartialEq for Vec { impl PartialOrd for Vec { fn partial_cmp(&self, other: &Bytes) -> Option { - other.partial_cmp(self) + <[u8] as PartialOrd<[u8]>>::partial_cmp(self, other) } } @@ -698,7 +698,7 @@ impl PartialEq for String { impl PartialOrd for String { fn partial_cmp(&self, other: &Bytes) -> Option { - other.partial_cmp(self) + <[u8] as PartialOrd<[u8]>>::partial_cmp(self.as_bytes(), other) } } @@ -710,7 +710,7 @@ impl PartialEq for &[u8] { impl PartialOrd for &[u8] { fn partial_cmp(&self, other: &Bytes) -> Option { - other.partial_cmp(self) + <[u8] as PartialOrd<[u8]>>::partial_cmp(self, other) } } @@ -722,7 +722,7 @@ impl PartialEq for &str { impl PartialOrd for &str { fn partial_cmp(&self, other: &Bytes) -> Option { - other.partial_cmp(self) + <[u8] as PartialOrd<[u8]>>::partial_cmp(self.as_bytes(), other) } } diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs index 1059454..5eb2d8c 100644 --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -1322,7 +1322,7 @@ impl PartialEq for [u8] { impl PartialOrd for [u8] { fn partial_cmp(&self, other: &BytesMut) -> Option { - other.partial_cmp(self) + <[u8] as PartialOrd<[u8]>>::partial_cmp(self, other) } } @@ -1346,7 +1346,7 @@ impl PartialEq for str { impl PartialOrd for str { fn partial_cmp(&self, other: &BytesMut) -> Option { - other.partial_cmp(self) + <[u8] as PartialOrd<[u8]>>::partial_cmp(self.as_bytes(), other) } } @@ -1394,7 +1394,7 @@ impl PartialEq for String { impl PartialOrd for String { fn partial_cmp(&self, other: &BytesMut) -> Option { - other.partial_cmp(self) + <[u8] as PartialOrd<[u8]>>::partial_cmp(self.as_bytes(), other) } } @@ -1422,7 +1422,7 @@ impl PartialEq for &[u8] { impl PartialOrd for &[u8] { fn partial_cmp(&self, other: &BytesMut) -> Option { - other.partial_cmp(self) + <[u8] as PartialOrd<[u8]>>::partial_cmp(self, other) } }