diff options
author | unexge <[email protected]> | 2021-04-23 14:18:10 +0100 |
---|---|---|
committer | unexge <[email protected]> | 2021-04-23 14:18:10 +0100 |
commit | 5e765895cf6fea42649a846c0297d95a9aa7b162 (patch) | |
tree | 6e5eecaa5b0f5ab792aa2e733484c33febeda925 | |
parent | 97270dfb9162bfcefa78a7ed39551069ae267f48 (diff) |
Add missing test case for "Convert to named struct" assist
-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] |