diff --git a/src/identifier.rs b/src/identifier.rs index c7fb1c9a..4cc387bc 100644 --- a/src/identifier.rs +++ b/src/identifier.rs @@ -200,6 +200,10 @@ impl Identifier { unsafe { ptr_as_str(&self.head) } } } + + pub(crate) fn ptr_eq(&self, rhs: &Self) -> bool { + self.head == rhs.head && self.tail == rhs.tail + } } impl Clone for Identifier { @@ -257,12 +261,6 @@ impl Drop for Identifier { } } -impl Identifier { - pub(crate) fn ptr_eq(&self, rhs: &Self) -> bool { - self.head == rhs.head && self.tail == rhs.tail - } -} - impl PartialEq for Identifier { fn eq(&self, rhs: &Self) -> bool { if self.ptr_eq(rhs) { diff --git a/src/impls.rs b/src/impls.rs index 24d7d281..280c8020 100644 --- a/src/impls.rs +++ b/src/impls.rs @@ -53,6 +53,7 @@ impl Ord for Prerelease { if self.identifier.ptr_eq(&rhs.identifier) { return Ordering::Equal; } + match self.is_empty() { // A real release compares greater than prerelease. true => return Ordering::Greater, @@ -110,6 +111,7 @@ impl Ord for BuildMetadata { if self.identifier.ptr_eq(&rhs.identifier) { return Ordering::Equal; } + let lhs = self.as_str().split('.'); let mut rhs = rhs.as_str().split('.');