aboutsummaryrefslogtreecommitdiff
path: root/docs/user/generated_assists.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'docs/user/generated_assists.adoc')
-rw-r--r--docs/user/generated_assists.adoc42
1 files changed, 42 insertions, 0 deletions
diff --git a/docs/user/generated_assists.adoc b/docs/user/generated_assists.adoc
index b8cdfb1cd..580ab4358 100644
--- a/docs/user/generated_assists.adoc
+++ b/docs/user/generated_assists.adoc
@@ -1,5 +1,6 @@
1[discrete] 1[discrete]
2=== `add_custom_impl` 2=== `add_custom_impl`
3**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/add_custom_impl.rs#L14[add_custom_impl.rs]
3 4
4Adds impl block for derived trait. 5Adds impl block for derived trait.
5 6
@@ -22,6 +23,7 @@ impl Debug for S {
22 23
23[discrete] 24[discrete]
24=== `add_derive` 25=== `add_derive`
26**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/add_derive.rs#L9[add_derive.rs]
25 27
26Adds a new `#[derive()]` clause to a struct or enum. 28Adds a new `#[derive()]` clause to a struct or enum.
27 29
@@ -45,6 +47,7 @@ struct Point {
45 47
46[discrete] 48[discrete]
47=== `add_explicit_type` 49=== `add_explicit_type`
50**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/add_explicit_type.rs#L9[add_explicit_type.rs]
48 51
49Specify type for a let binding. 52Specify type for a let binding.
50 53
@@ -65,6 +68,7 @@ fn main() {
65 68
66[discrete] 69[discrete]
67=== `add_from_impl_for_enum` 70=== `add_from_impl_for_enum`
71**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/add_from_impl_for_enum.rs#L7[add_from_impl_for_enum.rs]
68 72
69Adds a From impl for an enum variant with one tuple field. 73Adds a From impl for an enum variant with one tuple field.
70 74
@@ -87,6 +91,7 @@ impl From<u32> for A {
87 91
88[discrete] 92[discrete]
89=== `add_function` 93=== `add_function`
94**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/add_function.rs#L19[add_function.rs]
90 95
91Adds a stub function with a signature matching the function under the cursor. 96Adds a stub function with a signature matching the function under the cursor.
92 97
@@ -117,6 +122,7 @@ fn bar(arg: &str, baz: Baz) {
117 122
118[discrete] 123[discrete]
119=== `add_hash` 124=== `add_hash`
125**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/raw_string.rs#L65[raw_string.rs]
120 126
121Adds a hash to a raw string literal. 127Adds a hash to a raw string literal.
122 128
@@ -137,6 +143,7 @@ fn main() {
137 143
138[discrete] 144[discrete]
139=== `add_impl` 145=== `add_impl`
146**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/add_impl.rs#L6[add_impl.rs]
140 147
141Adds a new inherent impl for a type. 148Adds a new inherent impl for a type.
142 149
@@ -161,6 +168,7 @@ impl<T: Clone> Ctx<T> {
161 168
162[discrete] 169[discrete]
163=== `add_impl_default_members` 170=== `add_impl_default_members`
171**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/add_missing_impl_members.rs#L64[add_missing_impl_members.rs]
164 172
165Adds scaffold for overriding default impl members. 173Adds scaffold for overriding default impl members.
166 174
@@ -198,6 +206,7 @@ impl Trait for () {
198 206
199[discrete] 207[discrete]
200=== `add_impl_missing_members` 208=== `add_impl_missing_members`
209**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/add_missing_impl_members.rs#L24[add_missing_impl_members.rs]
201 210
202Adds scaffold for required impl members. 211Adds scaffold for required impl members.
203 212
@@ -233,6 +242,7 @@ impl Trait<u32> for () {
233 242
234[discrete] 243[discrete]
235=== `add_new` 244=== `add_new`
245**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/add_new.rs#L12[add_new.rs]
236 246
237Adds a new inherent impl for a type. 247Adds a new inherent impl for a type.
238 248
@@ -258,6 +268,7 @@ impl<T: Clone> Ctx<T> {
258 268
259[discrete] 269[discrete]
260=== `add_turbo_fish` 270=== `add_turbo_fish`
271**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/add_turbo_fish.rs#L10[add_turbo_fish.rs]
261 272
262Adds `::<_>` to a call of a generic method or function. 273Adds `::<_>` to a call of a generic method or function.
263 274
@@ -280,6 +291,7 @@ fn main() {
280 291
281[discrete] 292[discrete]
282=== `apply_demorgan` 293=== `apply_demorgan`
294**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/apply_demorgan.rs#L5[apply_demorgan.rs]
283 295
284Apply [De Morgan's law](https://en.wikipedia.org/wiki/De_Morgan%27s_laws). 296Apply [De Morgan's law](https://en.wikipedia.org/wiki/De_Morgan%27s_laws).
285This transforms expressions of the form `!l || !r` into `!(l && r)`. 297This transforms expressions of the form `!l || !r` into `!(l && r)`.
@@ -304,6 +316,7 @@ fn main() {
304 316
305[discrete] 317[discrete]
306=== `auto_import` 318=== `auto_import`
319**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/auto_import.rs#L18[auto_import.rs]
307 320
308If the name is unresolved, provides all possible imports for it. 321If the name is unresolved, provides all possible imports for it.
309 322
@@ -326,6 +339,7 @@ fn main() {
326 339
327[discrete] 340[discrete]
328=== `change_lifetime_anon_to_named` 341=== `change_lifetime_anon_to_named`
342**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/change_lifetime_anon_to_named.rs#L9[change_lifetime_anon_to_named.rs]
329 343
330Change an anonymous lifetime to a named lifetime. 344Change an anonymous lifetime to a named lifetime.
331 345
@@ -354,6 +368,7 @@ impl<'a> Cursor<'a> {
354 368
355[discrete] 369[discrete]
356=== `change_return_type_to_result` 370=== `change_return_type_to_result`
371**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/change_return_type_to_result.rs#L8[change_return_type_to_result.rs]
357 372
358Change the function's return type to Result. 373Change the function's return type to Result.
359 374
@@ -370,6 +385,7 @@ fn foo() -> Result<i32, ${0:_}> { Ok(42i32) }
370 385
371[discrete] 386[discrete]
372=== `change_visibility` 387=== `change_visibility`
388**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/change_visibility.rs#L14[change_visibility.rs]
373 389
374Adds or changes existing visibility specifier. 390Adds or changes existing visibility specifier.
375 391
@@ -386,6 +402,7 @@ pub(crate) fn frobnicate() {}
386 402
387[discrete] 403[discrete]
388=== `convert_to_guarded_return` 404=== `convert_to_guarded_return`
405**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/early_return.rs#L21[early_return.rs]
389 406
390Replace a large conditional with a guarded return. 407Replace a large conditional with a guarded return.
391 408
@@ -413,6 +430,7 @@ fn main() {
413 430
414[discrete] 431[discrete]
415=== `fill_match_arms` 432=== `fill_match_arms`
433**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/fill_match_arms.rs#L14[fill_match_arms.rs]
416 434
417Adds missing clauses to a `match` expression. 435Adds missing clauses to a `match` expression.
418 436
@@ -442,6 +460,7 @@ fn handle(action: Action) {
442 460
443[discrete] 461[discrete]
444=== `fix_visibility` 462=== `fix_visibility`
463**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/fix_visibility.rs#L13[fix_visibility.rs]
445 464
446Makes inaccessible item public. 465Makes inaccessible item public.
447 466
@@ -468,6 +487,7 @@ fn main() {
468 487
469[discrete] 488[discrete]
470=== `flip_binexpr` 489=== `flip_binexpr`
490**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/flip_binexpr.rs#L5[flip_binexpr.rs]
471 491
472Flips operands of a binary expression. 492Flips operands of a binary expression.
473 493
@@ -488,6 +508,7 @@ fn main() {
488 508
489[discrete] 509[discrete]
490=== `flip_comma` 510=== `flip_comma`
511**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/flip_comma.rs#L5[flip_comma.rs]
491 512
492Flips two comma-separated items. 513Flips two comma-separated items.
493 514
@@ -508,6 +529,7 @@ fn main() {
508 529
509[discrete] 530[discrete]
510=== `flip_trait_bound` 531=== `flip_trait_bound`
532**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/flip_trait_bound.rs#L9[flip_trait_bound.rs]
511 533
512Flips two trait bounds. 534Flips two trait bounds.
513 535
@@ -524,6 +546,7 @@ fn foo<T: Copy + Clone>() { }
524 546
525[discrete] 547[discrete]
526=== `inline_local_variable` 548=== `inline_local_variable`
549**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/inline_local_variable.rs#L13[inline_local_variable.rs]
527 550
528Inlines local variable. 551Inlines local variable.
529 552
@@ -545,6 +568,7 @@ fn main() {
545 568
546[discrete] 569[discrete]
547=== `introduce_variable` 570=== `introduce_variable`
571**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/introduce_variable.rs#L14[introduce_variable.rs]
548 572
549Extracts subexpression into a variable. 573Extracts subexpression into a variable.
550 574
@@ -566,6 +590,7 @@ fn main() {
566 590
567[discrete] 591[discrete]
568=== `invert_if` 592=== `invert_if`
593**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/invert_if.rs#L12[invert_if.rs]
569 594
570Apply invert_if 595Apply invert_if
571This transforms if expressions of the form `if !x {A} else {B}` into `if x {B} else {A}` 596This transforms if expressions of the form `if !x {A} else {B}` into `if x {B} else {A}`
@@ -589,6 +614,7 @@ fn main() {
589 614
590[discrete] 615[discrete]
591=== `make_raw_string` 616=== `make_raw_string`
617**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/raw_string.rs#L10[raw_string.rs]
592 618
593Adds `r#` to a plain string literal. 619Adds `r#` to a plain string literal.
594 620
@@ -609,6 +635,7 @@ fn main() {
609 635
610[discrete] 636[discrete]
611=== `make_usual_string` 637=== `make_usual_string`
638**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/raw_string.rs#L39[raw_string.rs]
612 639
613Turns a raw string into a plain string. 640Turns a raw string into a plain string.
614 641
@@ -629,6 +656,7 @@ fn main() {
629 656
630[discrete] 657[discrete]
631=== `merge_imports` 658=== `merge_imports`
659**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/merge_imports.rs#L14[merge_imports.rs]
632 660
633Merges two imports with a common prefix. 661Merges two imports with a common prefix.
634 662
@@ -646,6 +674,7 @@ use std::{fmt::Formatter, io};
646 674
647[discrete] 675[discrete]
648=== `merge_match_arms` 676=== `merge_match_arms`
677**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/merge_match_arms.rs#L11[merge_match_arms.rs]
649 678
650Merges identical match arms. 679Merges identical match arms.
651 680
@@ -675,6 +704,7 @@ fn handle(action: Action) {
675 704
676[discrete] 705[discrete]
677=== `move_arm_cond_to_match_guard` 706=== `move_arm_cond_to_match_guard`
707**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/move_guard.rs#L56[move_guard.rs]
678 708
679Moves if expression from match arm body into a guard. 709Moves if expression from match arm body into a guard.
680 710
@@ -705,6 +735,7 @@ fn handle(action: Action) {
705 735
706[discrete] 736[discrete]
707=== `move_bounds_to_where_clause` 737=== `move_bounds_to_where_clause`
738**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/move_bounds.rs#L10[move_bounds.rs]
708 739
709Moves inline type bounds to a where clause. 740Moves inline type bounds to a where clause.
710 741
@@ -725,6 +756,7 @@ fn apply<T, U, F>(f: F, x: T) -> U where F: FnOnce(T) -> U {
725 756
726[discrete] 757[discrete]
727=== `move_guard_to_arm_body` 758=== `move_guard_to_arm_body`
759**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/move_guard.rs#L8[move_guard.rs]
728 760
729Moves match guard into match arm body. 761Moves match guard into match arm body.
730 762
@@ -755,6 +787,7 @@ fn handle(action: Action) {
755 787
756[discrete] 788[discrete]
757=== `remove_dbg` 789=== `remove_dbg`
790**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/remove_dbg.rs#L8[remove_dbg.rs]
758 791
759Removes `dbg!()` macro call. 792Removes `dbg!()` macro call.
760 793
@@ -775,6 +808,7 @@ fn main() {
775 808
776[discrete] 809[discrete]
777=== `remove_hash` 810=== `remove_hash`
811**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/raw_string.rs#L89[raw_string.rs]
778 812
779Removes a hash from a raw string literal. 813Removes a hash from a raw string literal.
780 814
@@ -795,6 +829,7 @@ fn main() {
795 829
796[discrete] 830[discrete]
797=== `remove_mut` 831=== `remove_mut`
832**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/remove_mut.rs#L5[remove_mut.rs]
798 833
799Removes the `mut` keyword. 834Removes the `mut` keyword.
800 835
@@ -815,6 +850,7 @@ impl Walrus {
815 850
816[discrete] 851[discrete]
817=== `reorder_fields` 852=== `reorder_fields`
853**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/reorder_fields.rs#L10[reorder_fields.rs]
818 854
819Reorder the fields of record literals and record patterns in the same order as in 855Reorder the fields of record literals and record patterns in the same order as in
820the definition. 856the definition.
@@ -834,6 +870,7 @@ const test: Foo = Foo {foo: 1, bar: 0}
834 870
835[discrete] 871[discrete]
836=== `replace_if_let_with_match` 872=== `replace_if_let_with_match`
873**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/replace_if_let_with_match.rs#L13[replace_if_let_with_match.rs]
837 874
838Replaces `if let` with an else branch with a `match` expression. 875Replaces `if let` with an else branch with a `match` expression.
839 876
@@ -865,6 +902,7 @@ fn handle(action: Action) {
865 902
866[discrete] 903[discrete]
867=== `replace_let_with_if_let` 904=== `replace_let_with_if_let`
905**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/replace_let_with_if_let.rs#L14[replace_let_with_if_let.rs]
868 906
869Replaces `let` with an `if-let`. 907Replaces `let` with an `if-let`.
870 908
@@ -892,6 +930,7 @@ fn compute() -> Option<i32> { None }
892 930
893[discrete] 931[discrete]
894=== `replace_qualified_name_with_use` 932=== `replace_qualified_name_with_use`
933**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs#L6[replace_qualified_name_with_use.rs]
895 934
896Adds a use statement for a given fully-qualified name. 935Adds a use statement for a given fully-qualified name.
897 936
@@ -910,6 +949,7 @@ fn process(map: HashMap<String, String>) {}
910 949
911[discrete] 950[discrete]
912=== `replace_unwrap_with_match` 951=== `replace_unwrap_with_match`
952**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/replace_unwrap_with_match.rs#L17[replace_unwrap_with_match.rs]
913 953
914Replaces `unwrap` a `match` expression. Works for Result and Option. 954Replaces `unwrap` a `match` expression. Works for Result and Option.
915 955
@@ -937,6 +977,7 @@ fn main() {
937 977
938[discrete] 978[discrete]
939=== `split_import` 979=== `split_import`
980**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/split_import.rs#L7[split_import.rs]
940 981
941Wraps the tail of import into braces. 982Wraps the tail of import into braces.
942 983
@@ -953,6 +994,7 @@ use std::{collections::HashMap};
953 994
954[discrete] 995[discrete]
955=== `unwrap_block` 996=== `unwrap_block`
997**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_assists/src/handlers/unwrap_block.rs#L9[unwrap_block.rs]
956 998
957This assist removes if...else, for, while and loop control statements to just keep the body. 999This assist removes if...else, for, while and loop control statements to just keep the body.
958 1000