aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/user/assists.md37
-rw-r--r--docs/user/features.md51
2 files changed, 37 insertions, 51 deletions
diff --git a/docs/user/assists.md b/docs/user/assists.md
index eeb486832..7a64c80ad 100644
--- a/docs/user/assists.md
+++ b/docs/user/assists.md
@@ -137,6 +137,18 @@ fn main() {
137} 137}
138``` 138```
139 139
140## `change_visibility`
141
142Adds or changes existing visibility specifier.
143
144```rust
145// BEFORE
146fn<|> frobnicate() {}
147
148// AFTER
149pub(crate) fn frobnicate() {}
150```
151
140## `convert_to_guarded_return` 152## `convert_to_guarded_return`
141 153
142Replace a large conditional with a guarded return. 154Replace a large conditional with a guarded return.
@@ -159,3 +171,28 @@ fn main() {
159 bar(); 171 bar();
160} 172}
161``` 173```
174
175## `fill_match_arms`
176
177Adds missing clauses to a `match` expression.
178
179```rust
180// BEFORE
181enum Action { Move { distance: u32 }, Stop }
182
183fn handle(action: Action) {
184 match action {
185 <|>
186 }
187}
188
189// AFTER
190enum Action { Move { distance: u32 }, Stop }
191
192fn handle(action: Action) {
193 match action {
194 Action::Move{ distance } => (),
195 Action::Stop => (),
196 }
197}
198```
diff --git a/docs/user/features.md b/docs/user/features.md
index acf092cec..39dab710d 100644
--- a/docs/user/features.md
+++ b/docs/user/features.md
@@ -118,57 +118,6 @@ impl Debug<|> for Foo {
118} 118}
119``` 119```
120 120
121- Change Visibility
122
123```rust
124// before:
125<|>fn foo() {}
126
127// after:
128<|>pub(crate) fn foo() {}
129
130// after:
131<|>pub fn foo() {}
132```
133
134- Fill match arms
135
136```rust
137// before:
138enum A {
139 As,
140 Bs,
141 Cs(String),
142 Ds(String, String),
143 Es{x: usize, y: usize}
144}
145
146fn main() {
147 let a = A::As;
148 match a<|> {}
149}
150
151// after:
152enum A {
153 As,
154 Bs,
155 Cs(String),
156 Ds(String, String),
157 Es{x: usize, y: usize}
158}
159
160fn main() {
161 let a = A::As;
162 match <|>a {
163 A::As => (),
164 A::Bs => (),
165 A::Cs(_) => (),
166 A::Ds(_, _) => (),
167 A::Es{x, y} => (),
168 }
169}
170```
171
172- Fill struct fields 121- Fill struct fields
173 122
174```rust 123```rust