1
1
[discrete]
2
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
4
5
Adds impl block for derived trait.
5
6
@@ -22,6 +23,7 @@ impl Debug for S {
22
23
23
24
[discrete]
24
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
26
28
Adds a new `#[derive()]` clause to a struct or enum.
27
29
@@ -45,6 +47,7 @@ struct Point {
45
47
46
48
[discrete]
47
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
49
52
Specify type for a let binding.
50
53
@@ -65,6 +68,7 @@ fn main() {
65
68
66
69
[discrete]
67
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
69
73
Adds 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
92
[discrete]
89
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
91
96
Adds 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
123
[discrete]
119
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
121
127
Adds a hash to a raw string literal.
122
128
@@ -137,6 +143,7 @@ fn main() {
137
143
138
144
[discrete]
139
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
141
148
Adds a new inherent impl for a type.
142
149
@@ -161,6 +168,7 @@ impl<T: Clone> Ctx<T> {
161
168
162
169
[discrete]
163
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
165
173
Adds scaffold for overriding default impl members.
166
174
@@ -198,6 +206,7 @@ impl Trait for () {
198
206
199
207
[discrete]
200
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
202
211
Adds scaffold for required impl members.
203
212
@@ -233,6 +242,7 @@ impl Trait<u32> for () {
233
242
234
243
[discrete]
235
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
237
247
Adds a new inherent impl for a type.
238
248
@@ -258,6 +268,7 @@ impl<T: Clone> Ctx<T> {
258
268
259
269
[discrete]
260
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
262
273
Adds `::<_>` to a call of a generic method or function.
263
274
@@ -280,6 +291,7 @@ fn main() {
280
291
281
292
[discrete]
282
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
284
296
Apply [De Morgan's law](https://en.wikipedia.org/wiki/De_Morgan%27s_laws).
285
297
This transforms expressions of the form `!l || !r` into `!(l && r)`.
@@ -304,6 +316,7 @@ fn main() {
304
316
305
317
[discrete]
306
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
308
321
If the name is unresolved, provides all possible imports for it.
309
322
@@ -326,6 +339,7 @@ fn main() {
326
339
327
340
[discrete]
328
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
330
344
Change an anonymous lifetime to a named lifetime.
331
345
@@ -354,6 +368,7 @@ impl<'a> Cursor<'a> {
354
368
355
369
[discrete]
356
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
358
373
Change the function's return type to Result.
359
374
@@ -370,6 +385,7 @@ fn foo() -> Result<i32, ${0:_}> { Ok(42i32) }
370
385
371
386
[discrete]
372
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
374
390
Adds or changes existing visibility specifier.
375
391
@@ -386,6 +402,7 @@ pub(crate) fn frobnicate() {}
386
402
387
403
[discrete]
388
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
390
407
Replace a large conditional with a guarded return.
391
408
@@ -413,6 +430,7 @@ fn main() {
413
430
414
431
[discrete]
415
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
417
435
Adds missing clauses to a `match` expression.
418
436
@@ -442,6 +460,7 @@ fn handle(action: Action) {
442
460
443
461
[discrete]
444
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
446
465
Makes inaccessible item public.
447
466
@@ -468,6 +487,7 @@ fn main() {
468
487
469
488
[discrete]
470
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
472
492
Flips operands of a binary expression.
473
493
@@ -488,6 +508,7 @@ fn main() {
488
508
489
509
[discrete]
490
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
492
513
Flips two comma-separated items.
493
514
@@ -508,6 +529,7 @@ fn main() {
508
529
509
530
[discrete]
510
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
512
534
Flips two trait bounds.
513
535
@@ -524,6 +546,7 @@ fn foo<T: Copy + Clone>() { }
524
546
525
547
[discrete]
526
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
528
551
Inlines local variable.
529
552
@@ -545,6 +568,7 @@ fn main() {
545
568
546
569
[discrete]
547
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
549
573
Extracts subexpression into a variable.
550
574
@@ -566,6 +590,7 @@ fn main() {
566
590
567
591
[discrete]
568
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
570
595
Apply invert_if
571
596
This 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
615
[discrete]
591
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
593
619
Adds `r#` to a plain string literal.
594
620
@@ -609,6 +635,7 @@ fn main() {
609
635
610
636
[discrete]
611
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
613
640
Turns a raw string into a plain string.
614
641
@@ -629,6 +656,7 @@ fn main() {
629
656
630
657
[discrete]
631
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
633
661
Merges two imports with a common prefix.
634
662
@@ -646,6 +674,7 @@ use std::{fmt::Formatter, io};
646
674
647
675
[discrete]
648
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
650
679
Merges identical match arms.
651
680
@@ -675,6 +704,7 @@ fn handle(action: Action) {
675
704
676
705
[discrete]
677
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
679
709
Moves if expression from match arm body into a guard.
680
710
@@ -705,6 +735,7 @@ fn handle(action: Action) {
705
735
706
736
[discrete]
707
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
709
740
Moves 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
757
[discrete]
727
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
729
761
Moves match guard into match arm body.
730
762
@@ -755,6 +787,7 @@ fn handle(action: Action) {
755
787
756
788
[discrete]
757
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
759
792
Removes `dbg!()` macro call.
760
793
@@ -775,6 +808,7 @@ fn main() {
775
808
776
809
[discrete]
777
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
779
813
Removes a hash from a raw string literal.
780
814
@@ -795,6 +829,7 @@ fn main() {
795
829
796
830
[discrete]
797
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
799
834
Removes the `mut` keyword.
800
835
@@ -815,6 +850,7 @@ impl Walrus {
815
850
816
851
[discrete]
817
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
819
855
Reorder the fields of record literals and record patterns in the same order as in
820
856
the definition.
@@ -834,6 +870,7 @@ const test: Foo = Foo {foo: 1, bar: 0}
834
870
835
871
[discrete]
836
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
838
875
Replaces `if let` with an else branch with a `match` expression.
839
876
@@ -865,6 +902,7 @@ fn handle(action: Action) {
865
902
866
903
[discrete]
867
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
869
907
Replaces `let` with an `if-let`.
870
908
@@ -892,6 +930,7 @@ fn compute() -> Option<i32> { None }
892
930
893
931
[discrete]
894
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
896
935
Adds a use statement for a given fully-qualified name.
897
936
@@ -910,6 +949,7 @@ fn process(map: HashMap<String, String>) {}
910
949
911
950
[discrete]
912
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
914
954
Replaces `unwrap` a `match` expression. Works for Result and Option.
915
955
@@ -937,6 +977,7 @@ fn main() {
937
977
938
978
[discrete]
939
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
941
982
Wraps the tail of import into braces.
942
983
@@ -953,6 +994,7 @@ use std::{collections::HashMap};
953
994
954
995
[discrete]
955
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
957
999
This assist removes if...else, for, while and loop control statements to just keep the body.
958
1000
0 commit comments