@@ -426,6 +426,30 @@ fn main() {
426426```
427427
428428
429+ [discrete]
430+ === `convert_let_else_to_match`
431+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/convert_let_else_to_match.rs#L100[convert_let_else_to_match.rs]
432+
433+ Converts let-else statement to let statement and match expression.
434+
435+ .Before
436+ ```rust
437+ fn main() {
438+ let Ok(mut x) = f() else┃ { return };
439+ }
440+ ```
441+
442+ .After
443+ ```rust
444+ fn main() {
445+ let mut x = match f() {
446+ Ok(x) => x,
447+ _ => return,
448+ };
449+ }
450+ ```
451+
452+
429453[discrete]
430454=== `convert_to_guarded_return`
431455**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/convert_to_guarded_return.rs#L21[convert_to_guarded_return.rs]
@@ -985,35 +1009,64 @@ struct Point {
9851009
9861010
9871011[discrete]
988- === `generate_documentation_template `
989- **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_documentation_template.rs#L12 [generate_documentation_template.rs]
1012+ === `generate_doc_example `
1013+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_documentation_template.rs#L76 [generate_documentation_template.rs]
9901014
991- Adds a documentation template above a function definition / declaration .
1015+ Generates a rustdoc example when editing an item's documentation .
9921016
9931017.Before
9941018```rust
995- pub fn my_┃func(a: i32, b: i32) -> Result<(), std::io::Error> {
996- unimplemented!()
997- }
1019+ /// Adds two numbers.┃
1020+ pub fn add(a: i32, b: i32) -> i32 { a + b }
9981021```
9991022
10001023.After
10011024```rust
1002- /// .
1025+ /// Adds two numbers .
10031026///
10041027/// # Examples
10051028///
10061029/// ```
1007- /// use test::my_func ;
1030+ /// use test::add ;
10081031///
1009- /// assert_eq!(my_func (a, b), );
1032+ /// assert_eq!(add (a, b), );
10101033/// ```
1011- ///
1012- /// # Errors
1013- ///
1014- /// This function will return an error if .
1015- pub fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
1016- unimplemented!()
1034+ pub fn add(a: i32, b: i32) -> i32 { a + b }
1035+ ```
1036+
1037+
1038+ [discrete]
1039+ === `generate_documentation_template`
1040+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_documentation_template.rs#L13[generate_documentation_template.rs]
1041+
1042+ Adds a documentation template above a function definition / declaration.
1043+
1044+ .Before
1045+ ```rust
1046+ pub struct S;
1047+ impl S {
1048+ pub unsafe fn set_len┃(&mut self, len: usize) -> Result<(), std::io::Error> {
1049+ /* ... */
1050+ }
1051+ }
1052+ ```
1053+
1054+ .After
1055+ ```rust
1056+ pub struct S;
1057+ impl S {
1058+ /// Sets the length of this [`S`].
1059+ ///
1060+ /// # Errors
1061+ ///
1062+ /// This function will return an error if .
1063+ ///
1064+ /// # Safety
1065+ ///
1066+ /// .
1067+ pub unsafe fn set_len(&mut self, len: usize) -> Result<(), std::io::Error> {
1068+ /* ... */
1069+ }
10171070}
10181071```
10191072
@@ -1119,6 +1172,36 @@ impl Value {
11191172```
11201173
11211174
1175+ [discrete]
1176+ === `generate_enum_variant`
1177+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_enum_variant.rs#L10[generate_enum_variant.rs]
1178+
1179+ Adds a variant to an enum.
1180+
1181+ .Before
1182+ ```rust
1183+ enum Countries {
1184+ Ghana,
1185+ }
1186+
1187+ fn main() {
1188+ let country = Countries::Lesotho┃;
1189+ }
1190+ ```
1191+
1192+ .After
1193+ ```rust
1194+ enum Countries {
1195+ Ghana,
1196+ Lesotho,
1197+ }
1198+
1199+ fn main() {
1200+ let country = Countries::Lesotho;
1201+ }
1202+ ```
1203+
1204+
11221205[discrete]
11231206=== `generate_from_impl_for_enum`
11241207**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_from_impl_for_enum.rs#L6[generate_from_impl_for_enum.rs]
@@ -1193,7 +1276,6 @@ struct Person {
11931276}
11941277
11951278impl Person {
1196- #[must_use]
11971279 fn ┃name(&self) -> &str {
11981280 self.name.as_ref()
11991281 }
@@ -1203,7 +1285,7 @@ impl Person {
12031285
12041286[discrete]
12051287=== `generate_getter_mut`
1206- **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_getter.rs#L51 [generate_getter.rs]
1288+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_getter.rs#L50 [generate_getter.rs]
12071289
12081290Generate a mut getter method.
12091291
@@ -1221,7 +1303,6 @@ struct Person {
12211303}
12221304
12231305impl Person {
1224- #[must_use]
12251306 fn ┃name_mut(&mut self) -> &mut String {
12261307 &mut self.name
12271308 }
0 commit comments