From bccfa7cd80c76f1006a2c1b69cd2cd410d1a547f Mon Sep 17 00:00:00 2001 From: Alex Parrill Date: Sat, 21 Oct 2023 23:33:09 -0400 Subject: [PATCH] Fix clippy warning related to IString PartialOrd implementation --- src/string.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/string.rs b/src/string.rs index 38548bd..63bfbc4 100644 --- a/src/string.rs +++ b/src/string.rs @@ -126,7 +126,14 @@ impl Ord for IString { } } -impl_cmp_as_str!(PartialOrd::); +// Manual implementation of PartialOrd that uses Ord to ensure it is consistent, as +// recommended by clippy. +impl PartialOrd for IString { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + impl_cmp_as_str!(PartialOrd::); impl_cmp_as_str!(PartialOrd::); impl_cmp_as_str!(PartialOrd::);