diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-07 12:27:17 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-07 12:27:17 +0000 |
commit | 7967ce85cfc5fc2b1996425b44f2a45d0841c8ff (patch) | |
tree | 4495b9de7ea6c8e9dd9fd347d42517e9dee511fa /crates/assists/src/handlers/extract_struct_from_enum_variant.rs | |
parent | c3e9fb183bc287d83b97b776edc87c54d18d1a73 (diff) | |
parent | 72b9a4fbd3c12f3250b9157a1d44230e04ec8b22 (diff) |
Merge #7184
7184: Changes Cursor Marker To $0 r=matklad a=kevaundray
Co-authored-by: Kevaundray Wedderburn <[email protected]>
Diffstat (limited to 'crates/assists/src/handlers/extract_struct_from_enum_variant.rs')
-rw-r--r-- | crates/assists/src/handlers/extract_struct_from_enum_variant.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs index 6f35a061c..40028fc01 100644 --- a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs | |||
@@ -21,7 +21,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
21 | // Extracts a struct from enum variant. | 21 | // Extracts a struct from enum variant. |
22 | // | 22 | // |
23 | // ``` | 23 | // ``` |
24 | // enum A { <|>One(u32, u32) } | 24 | // enum A { $0One(u32, u32) } |
25 | // ``` | 25 | // ``` |
26 | // -> | 26 | // -> |
27 | // ``` | 27 | // ``` |
@@ -251,7 +251,7 @@ mod tests { | |||
251 | fn test_extract_struct_several_fields_tuple() { | 251 | fn test_extract_struct_several_fields_tuple() { |
252 | check_assist( | 252 | check_assist( |
253 | extract_struct_from_enum_variant, | 253 | extract_struct_from_enum_variant, |
254 | "enum A { <|>One(u32, u32) }", | 254 | "enum A { $0One(u32, u32) }", |
255 | r#"struct One(pub u32, pub u32); | 255 | r#"struct One(pub u32, pub u32); |
256 | 256 | ||
257 | enum A { One(One) }"#, | 257 | enum A { One(One) }"#, |
@@ -262,7 +262,7 @@ enum A { One(One) }"#, | |||
262 | fn test_extract_struct_several_fields_named() { | 262 | fn test_extract_struct_several_fields_named() { |
263 | check_assist( | 263 | check_assist( |
264 | extract_struct_from_enum_variant, | 264 | extract_struct_from_enum_variant, |
265 | "enum A { <|>One { foo: u32, bar: u32 } }", | 265 | "enum A { $0One { foo: u32, bar: u32 } }", |
266 | r#"struct One{ pub foo: u32, pub bar: u32 } | 266 | r#"struct One{ pub foo: u32, pub bar: u32 } |
267 | 267 | ||
268 | enum A { One(One) }"#, | 268 | enum A { One(One) }"#, |
@@ -273,7 +273,7 @@ enum A { One(One) }"#, | |||
273 | fn test_extract_struct_one_field_named() { | 273 | fn test_extract_struct_one_field_named() { |
274 | check_assist( | 274 | check_assist( |
275 | extract_struct_from_enum_variant, | 275 | extract_struct_from_enum_variant, |
276 | "enum A { <|>One { foo: u32 } }", | 276 | "enum A { $0One { foo: u32 } }", |
277 | r#"struct One{ pub foo: u32 } | 277 | r#"struct One{ pub foo: u32 } |
278 | 278 | ||
279 | enum A { One(One) }"#, | 279 | enum A { One(One) }"#, |
@@ -285,7 +285,7 @@ enum A { One(One) }"#, | |||
285 | check_assist( | 285 | check_assist( |
286 | extract_struct_from_enum_variant, | 286 | extract_struct_from_enum_variant, |
287 | r#"const One: () = (); | 287 | r#"const One: () = (); |
288 | enum A { <|>One(u32, u32) }"#, | 288 | enum A { $0One(u32, u32) }"#, |
289 | r#"const One: () = (); | 289 | r#"const One: () = (); |
290 | struct One(pub u32, pub u32); | 290 | struct One(pub u32, pub u32); |
291 | 291 | ||
@@ -297,7 +297,7 @@ enum A { One(One) }"#, | |||
297 | fn test_extract_struct_pub_visibility() { | 297 | fn test_extract_struct_pub_visibility() { |
298 | check_assist( | 298 | check_assist( |
299 | extract_struct_from_enum_variant, | 299 | extract_struct_from_enum_variant, |
300 | "pub enum A { <|>One(u32, u32) }", | 300 | "pub enum A { $0One(u32, u32) }", |
301 | r#"pub struct One(pub u32, pub u32); | 301 | r#"pub struct One(pub u32, pub u32); |
302 | 302 | ||
303 | pub enum A { One(One) }"#, | 303 | pub enum A { One(One) }"#, |
@@ -319,7 +319,7 @@ pub enum A { One(One) }"#, | |||
319 | } | 319 | } |
320 | 320 | ||
321 | pub enum MyEnum { | 321 | pub enum MyEnum { |
322 | <|>MyField(u8, u8), | 322 | $0MyField(u8, u8), |
323 | } | 323 | } |
324 | } | 324 | } |
325 | } | 325 | } |
@@ -361,7 +361,7 @@ fn another_fn() { | |||
361 | extract_struct_from_enum_variant, | 361 | extract_struct_from_enum_variant, |
362 | r#" | 362 | r#" |
363 | enum E { | 363 | enum E { |
364 | <|>V { i: i32, j: i32 } | 364 | $0V { i: i32, j: i32 } |
365 | } | 365 | } |
366 | 366 | ||
367 | fn f() { | 367 | fn f() { |
@@ -389,7 +389,7 @@ fn f() { | |||
389 | r#" | 389 | r#" |
390 | //- /main.rs | 390 | //- /main.rs |
391 | enum E { | 391 | enum E { |
392 | <|>V(i32, i32) | 392 | $0V(i32, i32) |
393 | } | 393 | } |
394 | mod foo; | 394 | mod foo; |
395 | 395 | ||
@@ -424,7 +424,7 @@ fn f() { | |||
424 | r#" | 424 | r#" |
425 | //- /main.rs | 425 | //- /main.rs |
426 | enum E { | 426 | enum E { |
427 | <|>V { i: i32, j: i32 } | 427 | $0V { i: i32, j: i32 } |
428 | } | 428 | } |
429 | mod foo; | 429 | mod foo; |
430 | 430 | ||
@@ -457,7 +457,7 @@ fn f() { | |||
457 | check_assist( | 457 | check_assist( |
458 | extract_struct_from_enum_variant, | 458 | extract_struct_from_enum_variant, |
459 | r#" | 459 | r#" |
460 | enum A { <|>One { a: u32, b: u32 } } | 460 | enum A { $0One { a: u32, b: u32 } } |
461 | 461 | ||
462 | struct B(A); | 462 | struct B(A); |
463 | 463 | ||
@@ -487,29 +487,29 @@ fn foo() { | |||
487 | 487 | ||
488 | #[test] | 488 | #[test] |
489 | fn test_extract_enum_not_applicable_for_element_with_no_fields() { | 489 | fn test_extract_enum_not_applicable_for_element_with_no_fields() { |
490 | check_not_applicable("enum A { <|>One }"); | 490 | check_not_applicable("enum A { $0One }"); |
491 | } | 491 | } |
492 | 492 | ||
493 | #[test] | 493 | #[test] |
494 | fn test_extract_enum_not_applicable_if_struct_exists() { | 494 | fn test_extract_enum_not_applicable_if_struct_exists() { |
495 | check_not_applicable( | 495 | check_not_applicable( |
496 | r#"struct One; | 496 | r#"struct One; |
497 | enum A { <|>One(u8, u32) }"#, | 497 | enum A { $0One(u8, u32) }"#, |
498 | ); | 498 | ); |
499 | } | 499 | } |
500 | 500 | ||
501 | #[test] | 501 | #[test] |
502 | fn test_extract_not_applicable_one_field() { | 502 | fn test_extract_not_applicable_one_field() { |
503 | check_not_applicable(r"enum A { <|>One(u32) }"); | 503 | check_not_applicable(r"enum A { $0One(u32) }"); |
504 | } | 504 | } |
505 | 505 | ||
506 | #[test] | 506 | #[test] |
507 | fn test_extract_not_applicable_no_field_tuple() { | 507 | fn test_extract_not_applicable_no_field_tuple() { |
508 | check_not_applicable(r"enum A { <|>None() }"); | 508 | check_not_applicable(r"enum A { $0None() }"); |
509 | } | 509 | } |
510 | 510 | ||
511 | #[test] | 511 | #[test] |
512 | fn test_extract_not_applicable_no_field_named() { | 512 | fn test_extract_not_applicable_no_field_named() { |
513 | check_not_applicable(r"enum A { <|>None {} }"); | 513 | check_not_applicable(r"enum A { $0None {} }"); |
514 | } | 514 | } |
515 | } | 515 | } |