File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -232,6 +232,7 @@ fn assist_order_field_struct() {
232232 assert_eq ! ( assists. next( ) . expect( "expected assist" ) . label, "Generate a getter method" ) ;
233233 assert_eq ! ( assists. next( ) . expect( "expected assist" ) . label, "Generate a mut getter method" ) ;
234234 assert_eq ! ( assists. next( ) . expect( "expected assist" ) . label, "Generate a setter method" ) ;
235+ assert_eq ! ( assists. next( ) . expect( "expected assist" ) . label, "Convert to tuple struct" ) ;
235236 assert_eq ! ( assists. next( ) . expect( "expected assist" ) . label, "Add `#[derive]`" ) ;
236237}
237238
Original file line number Diff line number Diff line change @@ -407,6 +407,47 @@ fn main() {
407407 )
408408}
409409
410+ #[ test]
411+ fn doctest_convert_named_struct_to_tuple_struct ( ) {
412+ check_doc_test (
413+ "convert_named_struct_to_tuple_struct" ,
414+ r#####"
415+ struct Point$0 { x: f32, y: f32 }
416+
417+ impl Point {
418+ pub fn new(x: f32, y: f32) -> Self {
419+ Point { x, y }
420+ }
421+
422+ pub fn x(&self) -> f32 {
423+ self.x
424+ }
425+
426+ pub fn y(&self) -> f32 {
427+ self.y
428+ }
429+ }
430+ "##### ,
431+ r#####"
432+ struct Point(f32, f32);
433+
434+ impl Point {
435+ pub fn new(x: f32, y: f32) -> Self {
436+ Point(x, y)
437+ }
438+
439+ pub fn x(&self) -> f32 {
440+ self.0
441+ }
442+
443+ pub fn y(&self) -> f32 {
444+ self.1
445+ }
446+ }
447+ "##### ,
448+ )
449+ }
450+
410451#[ test]
411452fn doctest_convert_to_guarded_return ( ) {
412453 check_doc_test (
You can’t perform that action at this time.
0 commit comments