diff options
Diffstat (limited to 'crates/ide_assists')
-rw-r--r-- | crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs b/crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs index cac4bec3d..b5b5ada5e 100644 --- a/crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs +++ b/crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs | |||
@@ -420,6 +420,46 @@ impl Outer { | |||
420 | } | 420 | } |
421 | }"#, | 421 | }"#, |
422 | ); | 422 | ); |
423 | |||
424 | check_assist( | ||
425 | convert_tuple_struct_to_named_struct, | ||
426 | r#" | ||
427 | struct Inner(u32); | ||
428 | struct Outer$0(Inner); | ||
429 | |||
430 | impl Outer { | ||
431 | fn new() -> Self { | ||
432 | Self(Inner(42)) | ||
433 | } | ||
434 | |||
435 | fn into_inner(self) -> u32 { | ||
436 | (self.0).0 | ||
437 | } | ||
438 | |||
439 | fn into_inner_destructed(self) -> u32 { | ||
440 | let Outer(Inner(x)) = self; | ||
441 | x | ||
442 | } | ||
443 | }"#, | ||
444 | r#" | ||
445 | struct Inner(u32); | ||
446 | struct Outer { field1: Inner } | ||
447 | |||
448 | impl Outer { | ||
449 | fn new() -> Self { | ||
450 | Self { field1: Inner(42) } | ||
451 | } | ||
452 | |||
453 | fn into_inner(self) -> u32 { | ||
454 | (self.field1).0 | ||
455 | } | ||
456 | |||
457 | fn into_inner_destructed(self) -> u32 { | ||
458 | let Outer { field1: Inner(x) } = self; | ||
459 | x | ||
460 | } | ||
461 | }"#, | ||
462 | ); | ||
423 | } | 463 | } |
424 | 464 | ||
425 | #[test] | 465 | #[test] |