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 | 29 |
1 files changed, 29 insertions, 0 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 1dc8dd95ab..27bba8732f 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 @@ -713,6 +713,35 @@ impl PartialOrd for Foo { } #[test] + fn add_custom_impl_partial_ord_tuple_struct() { + check_assist( + replace_derive_with_manual_impl, + r#" +//- minicore: ord +#[derive(Partial$0Ord)] +struct Foo(usize, usize, usize); +"#, + r#" +struct Foo(usize, usize, usize); + +impl PartialOrd for Foo { + $0fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> { + match self.0.partial_cmp(other.0) { + Some(core::cmp::Ordering::Eq) => {} + ord => return ord, + } + match self.1.partial_cmp(other.1) { + Some(core::cmp::Ordering::Eq) => {} + ord => return ord, + } + self.2.partial_cmp(other.2) + } +} +"#, + ) + } + + #[test] fn add_custom_impl_partial_eq_record_struct() { check_assist( replace_derive_with_manual_impl, |