aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/user/assists.md29
1 files changed, 16 insertions, 13 deletions
diff --git a/docs/user/assists.md b/docs/user/assists.md
index 182f07e98..ee1cfa142 100644
--- a/docs/user/assists.md
+++ b/docs/user/assists.md
@@ -1,5 +1,8 @@
1# Assists 1# Assists
2 2
3Cursor position or selection is signified by `┃` character.
4
5
3## `add_derive` 6## `add_derive`
4 7
5Adds a new `#[derive()]` clause to a struct or enum. 8Adds a new `#[derive()]` clause to a struct or enum.
@@ -8,7 +11,7 @@ Adds a new `#[derive()]` clause to a struct or enum.
8// BEFORE 11// BEFORE
9struct Point { 12struct Point {
10 x: u32, 13 x: u32,
11 y: u32,<|> 14 y: u32,
12} 15}
13 16
14// AFTER 17// AFTER
@@ -26,7 +29,7 @@ Specify type for a let binding.
26```rust 29```rust
27// BEFORE 30// BEFORE
28fn main() { 31fn main() {
29 let x<|> = 92; 32 let x = 92;
30} 33}
31 34
32// AFTER 35// AFTER
@@ -42,7 +45,7 @@ Adds a new inherent impl for a type.
42```rust 45```rust
43// BEFORE 46// BEFORE
44struct Ctx<T: Clone> { 47struct Ctx<T: Clone> {
45 data: T,<|> 48 data: T,
46} 49}
47 50
48// AFTER 51// AFTER
@@ -69,7 +72,7 @@ trait T {
69 72
70impl T for () { 73impl T for () {
71 Type X = (); 74 Type X = ();
72 fn foo(&self) {}<|> 75 fn foo(&self) {}
73 76
74} 77}
75 78
@@ -100,7 +103,7 @@ trait T {
100 fn bar(&self) {} 103 fn bar(&self) {}
101} 104}
102 105
103impl T for () {<|> 106impl T for () {
104 107
105} 108}
106 109
@@ -128,7 +131,7 @@ This means something of the form `!x` or `x != y`.
128```rust 131```rust
129// BEFORE 132// BEFORE
130fn main() { 133fn main() {
131 if x != 4 ||<|> !y {} 134 if x != 4 || !y {}
132} 135}
133 136
134// AFTER 137// AFTER
@@ -143,7 +146,7 @@ Adds or changes existing visibility specifier.
143 146
144```rust 147```rust
145// BEFORE 148// BEFORE
146fn<|> frobnicate() {} 149fn frobnicate() {}
147 150
148// AFTER 151// AFTER
149pub(crate) fn frobnicate() {} 152pub(crate) fn frobnicate() {}
@@ -156,7 +159,7 @@ Replace a large conditional with a guarded return.
156```rust 159```rust
157// BEFORE 160// BEFORE
158fn main() { 161fn main() {
159 <|>if cond { 162 if cond {
160 foo(); 163 foo();
161 bar(); 164 bar();
162 } 165 }
@@ -182,7 +185,7 @@ enum Action { Move { distance: u32 }, Stop }
182 185
183fn handle(action: Action) { 186fn handle(action: Action) {
184 match action { 187 match action {
185 <|> 188
186 } 189 }
187} 190}
188 191
@@ -204,7 +207,7 @@ Flips operands of a binary expression.
204```rust 207```rust
205// BEFORE 208// BEFORE
206fn main() { 209fn main() {
207 let _ = 90 +<|> 2; 210 let _ = 90 + 2;
208} 211}
209 212
210// AFTER 213// AFTER
@@ -220,7 +223,7 @@ Flips two comma-separated items.
220```rust 223```rust
221// BEFORE 224// BEFORE
222fn main() { 225fn main() {
223 ((1, 2),<|> (3, 4)); 226 ((1, 2), (3, 4));
224} 227}
225 228
226// AFTER 229// AFTER
@@ -236,7 +239,7 @@ Inlines local variable.
236```rust 239```rust
237// BEFORE 240// BEFORE
238fn main() { 241fn main() {
239 let x<|> = 1 + 2; 242 let x = 1 + 2;
240 x * 4; 243 x * 4;
241} 244}
242 245
@@ -253,7 +256,7 @@ Extracts subexpression into a variable.
253```rust 256```rust
254// BEFORE 257// BEFORE
255fn main() { 258fn main() {
256 <|>(1 + 2)<|> * 4; 259 (1 + 2) * 4;
257} 260}
258 261
259// AFTER 262// AFTER