aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'crates/assists/src/tests')
-rw-r--r--crates/assists/src/tests/generated.rs112
1 files changed, 56 insertions, 56 deletions
diff --git a/crates/assists/src/tests/generated.rs b/crates/assists/src/tests/generated.rs
index fdebee4fe..e28837b53 100644
--- a/crates/assists/src/tests/generated.rs
+++ b/crates/assists/src/tests/generated.rs
@@ -8,7 +8,7 @@ fn doctest_add_explicit_type() {
8 "add_explicit_type", 8 "add_explicit_type",
9 r#####" 9 r#####"
10fn main() { 10fn main() {
11 let x<|> = 92; 11 let x$0 = 92;
12} 12}
13"#####, 13"#####,
14 r#####" 14 r#####"
@@ -25,7 +25,7 @@ fn doctest_add_hash() {
25 "add_hash", 25 "add_hash",
26 r#####" 26 r#####"
27fn main() { 27fn main() {
28 r#"Hello,<|> World!"#; 28 r#"Hello,$0 World!"#;
29} 29}
30"#####, 30"#####,
31 r#####" 31 r#####"
@@ -49,7 +49,7 @@ trait Trait {
49 49
50impl Trait for () { 50impl Trait for () {
51 type X = (); 51 type X = ();
52 fn foo(&self) {}<|> 52 fn foo(&self) {}$0
53 53
54} 54}
55"#####, 55"#####,
@@ -81,7 +81,7 @@ trait Trait<T> {
81 fn bar(&self) {} 81 fn bar(&self) {}
82} 82}
83 83
84impl Trait<u32> for () {<|> 84impl Trait<u32> for () {$0
85 85
86} 86}
87"#####, 87"#####,
@@ -110,7 +110,7 @@ fn doctest_add_turbo_fish() {
110 r#####" 110 r#####"
111fn make<T>() -> T { todo!() } 111fn make<T>() -> T { todo!() }
112fn main() { 112fn main() {
113 let x = make<|>(); 113 let x = make$0();
114} 114}
115"#####, 115"#####,
116 r#####" 116 r#####"
@@ -128,7 +128,7 @@ fn doctest_apply_demorgan() {
128 "apply_demorgan", 128 "apply_demorgan",
129 r#####" 129 r#####"
130fn main() { 130fn main() {
131 if x != 4 ||<|> !y {} 131 if x != 4 ||$0 !y {}
132} 132}
133"#####, 133"#####,
134 r#####" 134 r#####"
@@ -145,7 +145,7 @@ fn doctest_auto_import() {
145 "auto_import", 145 "auto_import",
146 r#####" 146 r#####"
147fn main() { 147fn main() {
148 let map = HashMap<|>::new(); 148 let map = HashMap$0::new();
149} 149}
150pub mod std { pub mod collections { pub struct HashMap { } } } 150pub mod std { pub mod collections { pub struct HashMap { } } }
151"#####, 151"#####,
@@ -165,7 +165,7 @@ fn doctest_change_visibility() {
165 check_doc_test( 165 check_doc_test(
166 "change_visibility", 166 "change_visibility",
167 r#####" 167 r#####"
168<|>fn frobnicate() {} 168$0fn frobnicate() {}
169"#####, 169"#####,
170 r#####" 170 r#####"
171pub(crate) fn frobnicate() {} 171pub(crate) fn frobnicate() {}
@@ -178,7 +178,7 @@ fn doctest_convert_integer_literal() {
178 check_doc_test( 178 check_doc_test(
179 "convert_integer_literal", 179 "convert_integer_literal",
180 r#####" 180 r#####"
181const _: i32 = 10<|>; 181const _: i32 = 10$0;
182"#####, 182"#####,
183 r#####" 183 r#####"
184const _: i32 = 0b1010; 184const _: i32 = 0b1010;
@@ -192,7 +192,7 @@ fn doctest_convert_to_guarded_return() {
192 "convert_to_guarded_return", 192 "convert_to_guarded_return",
193 r#####" 193 r#####"
194fn main() { 194fn main() {
195 <|>if cond { 195 $0if cond {
196 foo(); 196 foo();
197 bar(); 197 bar();
198 } 198 }
@@ -220,7 +220,7 @@ mod foo {
220 pub struct Baz; 220 pub struct Baz;
221} 221}
222 222
223use foo::*<|>; 223use foo::*$0;
224 224
225fn qux(bar: Bar, baz: Baz) {} 225fn qux(bar: Bar, baz: Baz) {}
226"#####, 226"#####,
@@ -242,7 +242,7 @@ fn doctest_extract_struct_from_enum_variant() {
242 check_doc_test( 242 check_doc_test(
243 "extract_struct_from_enum_variant", 243 "extract_struct_from_enum_variant",
244 r#####" 244 r#####"
245enum A { <|>One(u32, u32) } 245enum A { $0One(u32, u32) }
246"#####, 246"#####,
247 r#####" 247 r#####"
248struct One(pub u32, pub u32); 248struct One(pub u32, pub u32);
@@ -258,7 +258,7 @@ fn doctest_extract_variable() {
258 "extract_variable", 258 "extract_variable",
259 r#####" 259 r#####"
260fn main() { 260fn main() {
261 <|>(1 + 2)<|> * 4; 261 $0(1 + 2)$0 * 4;
262} 262}
263"#####, 263"#####,
264 r#####" 264 r#####"
@@ -279,7 +279,7 @@ enum Action { Move { distance: u32 }, Stop }
279 279
280fn handle(action: Action) { 280fn handle(action: Action) {
281 match action { 281 match action {
282 <|> 282 $0
283 } 283 }
284} 284}
285"#####, 285"#####,
@@ -305,7 +305,7 @@ mod m {
305 fn frobnicate() {} 305 fn frobnicate() {}
306} 306}
307fn main() { 307fn main() {
308 m::frobnicate<|>() {} 308 m::frobnicate$0() {}
309} 309}
310"#####, 310"#####,
311 r#####" 311 r#####"
@@ -325,7 +325,7 @@ fn doctest_flip_binexpr() {
325 "flip_binexpr", 325 "flip_binexpr",
326 r#####" 326 r#####"
327fn main() { 327fn main() {
328 let _ = 90 +<|> 2; 328 let _ = 90 +$0 2;
329} 329}
330"#####, 330"#####,
331 r#####" 331 r#####"
@@ -342,7 +342,7 @@ fn doctest_flip_comma() {
342 "flip_comma", 342 "flip_comma",
343 r#####" 343 r#####"
344fn main() { 344fn main() {
345 ((1, 2),<|> (3, 4)); 345 ((1, 2),$0 (3, 4));
346} 346}
347"#####, 347"#####,
348 r#####" 348 r#####"
@@ -358,7 +358,7 @@ fn doctest_flip_trait_bound() {
358 check_doc_test( 358 check_doc_test(
359 "flip_trait_bound", 359 "flip_trait_bound",
360 r#####" 360 r#####"
361fn foo<T: Clone +<|> Copy>() { } 361fn foo<T: Clone +$0 Copy>() { }
362"#####, 362"#####,
363 r#####" 363 r#####"
364fn foo<T: Copy + Clone>() { } 364fn foo<T: Copy + Clone>() { }
@@ -373,7 +373,7 @@ fn doctest_generate_default_from_enum_variant() {
373 r#####" 373 r#####"
374enum Version { 374enum Version {
375 Undefined, 375 Undefined,
376 Minor<|>, 376 Minor$0,
377 Major, 377 Major,
378} 378}
379"#####, 379"#####,
@@ -400,7 +400,7 @@ fn doctest_generate_derive() {
400 r#####" 400 r#####"
401struct Point { 401struct Point {
402 x: u32, 402 x: u32,
403 y: u32,<|> 403 y: u32,$0
404} 404}
405"#####, 405"#####,
406 r#####" 406 r#####"
@@ -418,7 +418,7 @@ fn doctest_generate_from_impl_for_enum() {
418 check_doc_test( 418 check_doc_test(
419 "generate_from_impl_for_enum", 419 "generate_from_impl_for_enum",
420 r#####" 420 r#####"
421enum A { <|>One(u32) } 421enum A { $0One(u32) }
422"#####, 422"#####,
423 r#####" 423 r#####"
424enum A { One(u32) } 424enum A { One(u32) }
@@ -440,7 +440,7 @@ fn doctest_generate_function() {
440struct Baz; 440struct Baz;
441fn baz() -> Baz { Baz } 441fn baz() -> Baz { Baz }
442fn foo() { 442fn foo() {
443 bar<|>("", baz()); 443 bar$0("", baz());
444} 444}
445 445
446"#####, 446"#####,
@@ -465,7 +465,7 @@ fn doctest_generate_impl() {
465 "generate_impl", 465 "generate_impl",
466 r#####" 466 r#####"
467struct Ctx<T: Clone> { 467struct Ctx<T: Clone> {
468 data: T,<|> 468 data: T,$0
469} 469}
470"#####, 470"#####,
471 r#####" 471 r#####"
@@ -486,7 +486,7 @@ fn doctest_generate_new() {
486 "generate_new", 486 "generate_new",
487 r#####" 487 r#####"
488struct Ctx<T: Clone> { 488struct Ctx<T: Clone> {
489 data: T,<|> 489 data: T,$0
490} 490}
491"#####, 491"#####,
492 r#####" 492 r#####"
@@ -507,7 +507,7 @@ fn doctest_infer_function_return_type() {
507 check_doc_test( 507 check_doc_test(
508 "infer_function_return_type", 508 "infer_function_return_type",
509 r#####" 509 r#####"
510fn foo() { 4<|>2i32 } 510fn foo() { 4$02i32 }
511"#####, 511"#####,
512 r#####" 512 r#####"
513fn foo() -> i32 { 42i32 } 513fn foo() -> i32 { 42i32 }
@@ -522,7 +522,7 @@ fn doctest_inline_function() {
522 r#####" 522 r#####"
523fn add(a: u32, b: u32) -> u32 { a + b } 523fn add(a: u32, b: u32) -> u32 { a + b }
524fn main() { 524fn main() {
525 let x = add<|>(1, 2); 525 let x = add$0(1, 2);
526} 526}
527"#####, 527"#####,
528 r#####" 528 r#####"
@@ -544,7 +544,7 @@ fn doctest_inline_local_variable() {
544 "inline_local_variable", 544 "inline_local_variable",
545 r#####" 545 r#####"
546fn main() { 546fn main() {
547 let x<|> = 1 + 2; 547 let x$0 = 1 + 2;
548 x * 4; 548 x * 4;
549} 549}
550"#####, 550"#####,
@@ -561,7 +561,7 @@ fn doctest_introduce_named_lifetime() {
561 check_doc_test( 561 check_doc_test(
562 "introduce_named_lifetime", 562 "introduce_named_lifetime",
563 r#####" 563 r#####"
564impl Cursor<'_<|>> { 564impl Cursor<'_$0> {
565 fn node(self) -> &SyntaxNode { 565 fn node(self) -> &SyntaxNode {
566 match self { 566 match self {
567 Cursor::Replace(node) | Cursor::Before(node) => node, 567 Cursor::Replace(node) | Cursor::Before(node) => node,
@@ -587,7 +587,7 @@ fn doctest_invert_if() {
587 "invert_if", 587 "invert_if",
588 r#####" 588 r#####"
589fn main() { 589fn main() {
590 if<|> !y { A } else { B } 590 if$0 !y { A } else { B }
591} 591}
592"#####, 592"#####,
593 r#####" 593 r#####"
@@ -604,7 +604,7 @@ fn doctest_make_raw_string() {
604 "make_raw_string", 604 "make_raw_string",
605 r#####" 605 r#####"
606fn main() { 606fn main() {
607 "Hello,<|> World!"; 607 "Hello,$0 World!";
608} 608}
609"#####, 609"#####,
610 r#####" 610 r#####"
@@ -621,7 +621,7 @@ fn doctest_make_usual_string() {
621 "make_usual_string", 621 "make_usual_string",
622 r#####" 622 r#####"
623fn main() { 623fn main() {
624 r#"Hello,<|> "World!""#; 624 r#"Hello,$0 "World!""#;
625} 625}
626"#####, 626"#####,
627 r#####" 627 r#####"
@@ -637,7 +637,7 @@ fn doctest_merge_imports() {
637 check_doc_test( 637 check_doc_test(
638 "merge_imports", 638 "merge_imports",
639 r#####" 639 r#####"
640use std::<|>fmt::Formatter; 640use std::$0fmt::Formatter;
641use std::io; 641use std::io;
642"#####, 642"#####,
643 r#####" 643 r#####"
@@ -655,7 +655,7 @@ enum Action { Move { distance: u32 }, Stop }
655 655
656fn handle(action: Action) { 656fn handle(action: Action) {
657 match action { 657 match action {
658 <|>Action::Move(..) => foo(), 658 $0Action::Move(..) => foo(),
659 Action::Stop => foo(), 659 Action::Stop => foo(),
660 } 660 }
661} 661}
@@ -681,7 +681,7 @@ enum Action { Move { distance: u32 }, Stop }
681 681
682fn handle(action: Action) { 682fn handle(action: Action) {
683 match action { 683 match action {
684 Action::Move { distance } => <|>if distance > 10 { foo() }, 684 Action::Move { distance } => $0if distance > 10 { foo() },
685 _ => (), 685 _ => (),
686 } 686 }
687} 687}
@@ -704,7 +704,7 @@ fn doctest_move_bounds_to_where_clause() {
704 check_doc_test( 704 check_doc_test(
705 "move_bounds_to_where_clause", 705 "move_bounds_to_where_clause",
706 r#####" 706 r#####"
707fn apply<T, U, <|>F: FnOnce(T) -> U>(f: F, x: T) -> U { 707fn apply<T, U, $0F: FnOnce(T) -> U>(f: F, x: T) -> U {
708 f(x) 708 f(x)
709} 709}
710"#####, 710"#####,
@@ -725,7 +725,7 @@ enum Action { Move { distance: u32 }, Stop }
725 725
726fn handle(action: Action) { 726fn handle(action: Action) {
727 match action { 727 match action {
728 Action::Move { distance } <|>if distance > 10 => foo(), 728 Action::Move { distance } $0if distance > 10 => foo(),
729 _ => (), 729 _ => (),
730 } 730 }
731} 731}
@@ -750,7 +750,7 @@ fn doctest_move_module_to_file() {
750 check_doc_test( 750 check_doc_test(
751 "move_module_to_file", 751 "move_module_to_file",
752 r#####" 752 r#####"
753mod <|>foo { 753mod $0foo {
754 fn t() {} 754 fn t() {}
755} 755}
756"#####, 756"#####,
@@ -769,7 +769,7 @@ fn main() {
769 let mut foo = 6; 769 let mut foo = 6;
770 770
771 if true { 771 if true {
772 <|>foo = 5; 772 $0foo = 5;
773 } else { 773 } else {
774 foo = 4; 774 foo = 4;
775 } 775 }
@@ -795,7 +795,7 @@ fn doctest_qualify_path() {
795 "qualify_path", 795 "qualify_path",
796 r#####" 796 r#####"
797fn main() { 797fn main() {
798 let map = HashMap<|>::new(); 798 let map = HashMap$0::new();
799} 799}
800pub mod std { pub mod collections { pub struct HashMap { } } } 800pub mod std { pub mod collections { pub struct HashMap { } } }
801"#####, 801"#####,
@@ -814,7 +814,7 @@ fn doctest_remove_dbg() {
814 "remove_dbg", 814 "remove_dbg",
815 r#####" 815 r#####"
816fn main() { 816fn main() {
817 <|>dbg!(92); 817 $0dbg!(92);
818} 818}
819"#####, 819"#####,
820 r#####" 820 r#####"
@@ -831,7 +831,7 @@ fn doctest_remove_hash() {
831 "remove_hash", 831 "remove_hash",
832 r#####" 832 r#####"
833fn main() { 833fn main() {
834 r#"Hello,<|> World!"#; 834 r#"Hello,$0 World!"#;
835} 835}
836"#####, 836"#####,
837 r#####" 837 r#####"
@@ -848,7 +848,7 @@ fn doctest_remove_mut() {
848 "remove_mut", 848 "remove_mut",
849 r#####" 849 r#####"
850impl Walrus { 850impl Walrus {
851 fn feed(&mut<|> self, amount: u32) {} 851 fn feed(&mut$0 self, amount: u32) {}
852} 852}
853"#####, 853"#####,
854 r#####" 854 r#####"
@@ -864,7 +864,7 @@ fn doctest_remove_unused_param() {
864 check_doc_test( 864 check_doc_test(
865 "remove_unused_param", 865 "remove_unused_param",
866 r#####" 866 r#####"
867fn frobnicate(x: i32<|>) {} 867fn frobnicate(x: i32$0) {}
868 868
869fn main() { 869fn main() {
870 frobnicate(92); 870 frobnicate(92);
@@ -886,7 +886,7 @@ fn doctest_reorder_fields() {
886 "reorder_fields", 886 "reorder_fields",
887 r#####" 887 r#####"
888struct Foo {foo: i32, bar: i32}; 888struct Foo {foo: i32, bar: i32};
889const test: Foo = <|>Foo {bar: 0, foo: 1} 889const test: Foo = $0Foo {bar: 0, foo: 1}
890"#####, 890"#####,
891 r#####" 891 r#####"
892struct Foo {foo: i32, bar: i32}; 892struct Foo {foo: i32, bar: i32};
@@ -901,7 +901,7 @@ fn doctest_replace_derive_with_manual_impl() {
901 "replace_derive_with_manual_impl", 901 "replace_derive_with_manual_impl",
902 r#####" 902 r#####"
903trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; } 903trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; }
904#[derive(Deb<|>ug, Display)] 904#[derive(Deb$0ug, Display)]
905struct S; 905struct S;
906"#####, 906"#####,
907 r#####" 907 r#####"
@@ -926,7 +926,7 @@ fn doctest_replace_if_let_with_match() {
926enum Action { Move { distance: u32 }, Stop } 926enum Action { Move { distance: u32 }, Stop }
927 927
928fn handle(action: Action) { 928fn handle(action: Action) {
929 <|>if let Action::Move { distance } = action { 929 $0if let Action::Move { distance } = action {
930 foo(distance) 930 foo(distance)
931 } else { 931 } else {
932 bar() 932 bar()
@@ -951,7 +951,7 @@ fn doctest_replace_impl_trait_with_generic() {
951 check_doc_test( 951 check_doc_test(
952 "replace_impl_trait_with_generic", 952 "replace_impl_trait_with_generic",
953 r#####" 953 r#####"
954fn foo(bar: <|>impl Bar) {} 954fn foo(bar: $0impl Bar) {}
955"#####, 955"#####,
956 r#####" 956 r#####"
957fn foo<B: Bar>(bar: B) {} 957fn foo<B: Bar>(bar: B) {}
@@ -967,7 +967,7 @@ fn doctest_replace_let_with_if_let() {
967enum Option<T> { Some(T), None } 967enum Option<T> { Some(T), None }
968 968
969fn main(action: Action) { 969fn main(action: Action) {
970 <|>let x = compute(); 970 $0let x = compute();
971} 971}
972 972
973fn compute() -> Option<i32> { None } 973fn compute() -> Option<i32> { None }
@@ -993,7 +993,7 @@ fn doctest_replace_match_with_if_let() {
993enum Action { Move { distance: u32 }, Stop } 993enum Action { Move { distance: u32 }, Stop }
994 994
995fn handle(action: Action) { 995fn handle(action: Action) {
996 <|>match action { 996 $0match action {
997 Action::Move { distance } => foo(distance), 997 Action::Move { distance } => foo(distance),
998 _ => bar(), 998 _ => bar(),
999 } 999 }
@@ -1018,7 +1018,7 @@ fn doctest_replace_qualified_name_with_use() {
1018 check_doc_test( 1018 check_doc_test(
1019 "replace_qualified_name_with_use", 1019 "replace_qualified_name_with_use",
1020 r#####" 1020 r#####"
1021fn process(map: std::collections::<|>HashMap<String, String>) {} 1021fn process(map: std::collections::$0HashMap<String, String>) {}
1022"#####, 1022"#####,
1023 r#####" 1023 r#####"
1024use std::collections::HashMap; 1024use std::collections::HashMap;
@@ -1034,7 +1034,7 @@ fn doctest_replace_string_with_char() {
1034 "replace_string_with_char", 1034 "replace_string_with_char",
1035 r#####" 1035 r#####"
1036fn main() { 1036fn main() {
1037 find("{<|>"); 1037 find("{$0");
1038} 1038}
1039"#####, 1039"#####,
1040 r#####" 1040 r#####"
@@ -1053,7 +1053,7 @@ fn doctest_replace_unwrap_with_match() {
1053enum Result<T, E> { Ok(T), Err(E) } 1053enum Result<T, E> { Ok(T), Err(E) }
1054fn main() { 1054fn main() {
1055 let x: Result<i32, i32> = Result::Ok(92); 1055 let x: Result<i32, i32> = Result::Ok(92);
1056 let y = x.<|>unwrap(); 1056 let y = x.$0unwrap();
1057} 1057}
1058"#####, 1058"#####,
1059 r#####" 1059 r#####"
@@ -1074,7 +1074,7 @@ fn doctest_split_import() {
1074 check_doc_test( 1074 check_doc_test(
1075 "split_import", 1075 "split_import",
1076 r#####" 1076 r#####"
1077use std::<|>collections::HashMap; 1077use std::$0collections::HashMap;
1078"#####, 1078"#####,
1079 r#####" 1079 r#####"
1080use std::{collections::HashMap}; 1080use std::{collections::HashMap};
@@ -1087,7 +1087,7 @@ fn doctest_toggle_ignore() {
1087 check_doc_test( 1087 check_doc_test(
1088 "toggle_ignore", 1088 "toggle_ignore",
1089 r#####" 1089 r#####"
1090<|>#[test] 1090$0#[test]
1091fn arithmetics { 1091fn arithmetics {
1092 assert_eq!(2 + 2, 5); 1092 assert_eq!(2 + 2, 5);
1093} 1093}
@@ -1108,7 +1108,7 @@ fn doctest_unwrap_block() {
1108 "unwrap_block", 1108 "unwrap_block",
1109 r#####" 1109 r#####"
1110fn foo() { 1110fn foo() {
1111 if true {<|> 1111 if true {$0
1112 println!("foo"); 1112 println!("foo");
1113 } 1113 }
1114} 1114}
@@ -1126,7 +1126,7 @@ fn doctest_wrap_return_type_in_result() {
1126 check_doc_test( 1126 check_doc_test(
1127 "wrap_return_type_in_result", 1127 "wrap_return_type_in_result",
1128 r#####" 1128 r#####"
1129fn foo() -> i32<|> { 42i32 } 1129fn foo() -> i32$0 { 42i32 }
1130"#####, 1130"#####,
1131 r#####" 1131 r#####"
1132fn foo() -> Result<i32, ${0:_}> { Ok(42i32) } 1132fn foo() -> Result<i32, ${0:_}> { Ok(42i32) }