Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs')
| -rw-r--r-- | crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs b/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs index 138c694d49..042f31e5c4 100644 --- a/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs +++ b/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs @@ -722,7 +722,15 @@ struct Foo { impl PartialOrd for Foo { $0fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> { - (self.bin, self.bar, self.baz).partial_cmp(&(other.bin, other.bar, other.baz)) + match self.bin.partial_cmp(&other.bin) { + Some(core::cmp::Ordering::Equal) => {} + ord => return ord, + } + match self.bar.partial_cmp(&other.bar) { + Some(core::cmp::Ordering::Equal) => {} + ord => return ord, + } + self.baz.partial_cmp(&other.baz) } } "#, @@ -743,7 +751,15 @@ struct Foo(usize, usize, usize); impl PartialOrd for Foo { $0fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> { - (self.0, self.1, self.2).partial_cmp(&(other.0, other.1, other.2)) + match self.0.partial_cmp(&other.0) { + Some(core::cmp::Ordering::Equal) => {} + ord => return ord, + } + match self.1.partial_cmp(&other.1) { + Some(core::cmp::Ordering::Equal) => {} + ord => return ord, + } + self.2.partial_cmp(&other.2) } } "#, |