Skip to content

Commit 899570a

Browse files
committed
Link to the specific source line
1 parent f20775d commit 899570a

File tree

5 files changed

+90
-36
lines changed

5 files changed

+90
-36
lines changed

docs/user/generated_assists.adoc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[discrete]
22
=== `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]
34

45
Adds impl block for derived trait.
56

@@ -22,6 +23,7 @@ impl Debug for S {
2223

2324
[discrete]
2425
=== `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]
2527

2628
Adds a new `#[derive()]` clause to a struct or enum.
2729

@@ -45,6 +47,7 @@ struct Point {
4547

4648
[discrete]
4749
=== `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]
4851

4952
Specify type for a let binding.
5053

@@ -65,6 +68,7 @@ fn main() {
6568

6669
[discrete]
6770
=== `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]
6872

6973
Adds a From impl for an enum variant with one tuple field.
7074

@@ -87,6 +91,7 @@ impl From<u32> for A {
8791

8892
[discrete]
8993
=== `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]
9095

9196
Adds a stub function with a signature matching the function under the cursor.
9297

@@ -117,6 +122,7 @@ fn bar(arg: &str, baz: Baz) {
117122

118123
[discrete]
119124
=== `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]
120126

121127
Adds a hash to a raw string literal.
122128

@@ -137,6 +143,7 @@ fn main() {
137143

138144
[discrete]
139145
=== `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]
140147

141148
Adds a new inherent impl for a type.
142149

@@ -161,6 +168,7 @@ impl<T: Clone> Ctx<T> {
161168

162169
[discrete]
163170
=== `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]
164172

165173
Adds scaffold for overriding default impl members.
166174

@@ -198,6 +206,7 @@ impl Trait for () {
198206

199207
[discrete]
200208
=== `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]
201210

202211
Adds scaffold for required impl members.
203212

@@ -233,6 +242,7 @@ impl Trait<u32> for () {
233242

234243
[discrete]
235244
=== `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]
236246

237247
Adds a new inherent impl for a type.
238248

@@ -258,6 +268,7 @@ impl<T: Clone> Ctx<T> {
258268

259269
[discrete]
260270
=== `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]
261272

262273
Adds `::<_>` to a call of a generic method or function.
263274

@@ -280,6 +291,7 @@ fn main() {
280291

281292
[discrete]
282293
=== `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]
283295

284296
Apply [De Morgan's law](https://en.wikipedia.org/wiki/De_Morgan%27s_laws).
285297
This transforms expressions of the form `!l || !r` into `!(l && r)`.
@@ -304,6 +316,7 @@ fn main() {
304316

305317
[discrete]
306318
=== `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]
307320

308321
If the name is unresolved, provides all possible imports for it.
309322

@@ -326,6 +339,7 @@ fn main() {
326339

327340
[discrete]
328341
=== `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]
329343

330344
Change an anonymous lifetime to a named lifetime.
331345

@@ -354,6 +368,7 @@ impl<'a> Cursor<'a> {
354368

355369
[discrete]
356370
=== `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]
357372

358373
Change the function's return type to Result.
359374

@@ -370,6 +385,7 @@ fn foo() -> Result<i32, ${0:_}> { Ok(42i32) }
370385

371386
[discrete]
372387
=== `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]
373389

374390
Adds or changes existing visibility specifier.
375391

@@ -386,6 +402,7 @@ pub(crate) fn frobnicate() {}
386402

387403
[discrete]
388404
=== `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]
389406

390407
Replace a large conditional with a guarded return.
391408

@@ -413,6 +430,7 @@ fn main() {
413430

414431
[discrete]
415432
=== `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]
416434

417435
Adds missing clauses to a `match` expression.
418436

@@ -442,6 +460,7 @@ fn handle(action: Action) {
442460

443461
[discrete]
444462
=== `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]
445464

446465
Makes inaccessible item public.
447466

@@ -468,6 +487,7 @@ fn main() {
468487

469488
[discrete]
470489
=== `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]
471491

472492
Flips operands of a binary expression.
473493

@@ -488,6 +508,7 @@ fn main() {
488508

489509
[discrete]
490510
=== `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]
491512

492513
Flips two comma-separated items.
493514

@@ -508,6 +529,7 @@ fn main() {
508529

509530
[discrete]
510531
=== `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]
511533

512534
Flips two trait bounds.
513535

@@ -524,6 +546,7 @@ fn foo<T: Copy + Clone>() { }
524546

525547
[discrete]
526548
=== `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]
527550

528551
Inlines local variable.
529552

@@ -545,6 +568,7 @@ fn main() {
545568

546569
[discrete]
547570
=== `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]
548572

549573
Extracts subexpression into a variable.
550574

@@ -566,6 +590,7 @@ fn main() {
566590

567591
[discrete]
568592
=== `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]
569594

570595
Apply invert_if
571596
This transforms if expressions of the form `if !x {A} else {B}` into `if x {B} else {A}`
@@ -589,6 +614,7 @@ fn main() {
589614

590615
[discrete]
591616
=== `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]
592618

593619
Adds `r#` to a plain string literal.
594620

@@ -609,6 +635,7 @@ fn main() {
609635

610636
[discrete]
611637
=== `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]
612639

613640
Turns a raw string into a plain string.
614641

@@ -629,6 +656,7 @@ fn main() {
629656

630657
[discrete]
631658
=== `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]
632660

633661
Merges two imports with a common prefix.
634662

@@ -646,6 +674,7 @@ use std::{fmt::Formatter, io};
646674

647675
[discrete]
648676
=== `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]
649678

650679
Merges identical match arms.
651680

@@ -675,6 +704,7 @@ fn handle(action: Action) {
675704

676705
[discrete]
677706
=== `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]
678708

679709
Moves if expression from match arm body into a guard.
680710

@@ -705,6 +735,7 @@ fn handle(action: Action) {
705735

706736
[discrete]
707737
=== `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]
708739

709740
Moves inline type bounds to a where clause.
710741

@@ -725,6 +756,7 @@ fn apply<T, U, F>(f: F, x: T) -> U where F: FnOnce(T) -> U {
725756

726757
[discrete]
727758
=== `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]
728760

729761
Moves match guard into match arm body.
730762

@@ -755,6 +787,7 @@ fn handle(action: Action) {
755787

756788
[discrete]
757789
=== `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]
758791

759792
Removes `dbg!()` macro call.
760793

@@ -775,6 +808,7 @@ fn main() {
775808

776809
[discrete]
777810
=== `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]
778812

779813
Removes a hash from a raw string literal.
780814

@@ -795,6 +829,7 @@ fn main() {
795829

796830
[discrete]
797831
=== `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]
798833

799834
Removes the `mut` keyword.
800835

@@ -815,6 +850,7 @@ impl Walrus {
815850

816851
[discrete]
817852
=== `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]
818854

819855
Reorder the fields of record literals and record patterns in the same order as in
820856
the definition.
@@ -834,6 +870,7 @@ const test: Foo = Foo {foo: 1, bar: 0}
834870

835871
[discrete]
836872
=== `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]
837874

838875
Replaces `if let` with an else branch with a `match` expression.
839876

@@ -865,6 +902,7 @@ fn handle(action: Action) {
865902

866903
[discrete]
867904
=== `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]
868906

869907
Replaces `let` with an `if-let`.
870908

@@ -892,6 +930,7 @@ fn compute() -> Option<i32> { None }
892930

893931
[discrete]
894932
=== `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]
895934

896935
Adds a use statement for a given fully-qualified name.
897936

@@ -910,6 +949,7 @@ fn process(map: HashMap<String, String>) {}
910949

911950
[discrete]
912951
=== `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]
913953

914954
Replaces `unwrap` a `match` expression. Works for Result and Option.
915955

@@ -937,6 +977,7 @@ fn main() {
937977

938978
[discrete]
939979
=== `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]
940981

941982
Wraps the tail of import into braces.
942983

@@ -953,6 +994,7 @@ use std::{collections::HashMap};
953994

954995
[discrete]
955996
=== `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]
956998

957999
This assist removes if...else, for, while and loop control statements to just keep the body.
9581000

0 commit comments

Comments
 (0)