diff options
Diffstat (limited to 'docs/user/assists.md')
-rw-r--r-- | docs/user/assists.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/user/assists.md b/docs/user/assists.md index 4ad7ea59d..b5d813b54 100644 --- a/docs/user/assists.md +++ b/docs/user/assists.md | |||
@@ -56,6 +56,24 @@ fn main() { | |||
56 | } | 56 | } |
57 | ``` | 57 | ``` |
58 | 58 | ||
59 | ## `add_from_impl_for_enum` | ||
60 | |||
61 | Adds a From impl for an enum variant with one tuple field. | ||
62 | |||
63 | ```rust | ||
64 | // BEFORE | ||
65 | enum A { ┃One(u32) } | ||
66 | |||
67 | // AFTER | ||
68 | enum A { One(u32) } | ||
69 | |||
70 | impl From<u32> for A { | ||
71 | fn from(v: u32) -> Self { | ||
72 | A::One(v) | ||
73 | } | ||
74 | } | ||
75 | ``` | ||
76 | |||
59 | ## `add_function` | 77 | ## `add_function` |
60 | 78 | ||
61 | Adds a stub function with a signature matching the function under the cursor. | 79 | Adds a stub function with a signature matching the function under the cursor. |