diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-09 11:13:17 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-09 11:13:17 +0000 |
commit | 297240744d1d55ef5451ed4db3a3f37f8df38380 (patch) | |
tree | 9491e5583639b3984eb3fc9927f469e66c4db39f /crates/ide_completion/src | |
parent | 6bd0a6eef64f8a4b18a723c99cba03cb88c516f3 (diff) | |
parent | 73590f0f0b0fa0b1c61c157682f4da7b0a7981ac (diff) |
Merge #7928
7928: Add completion to turn x.err into Err(x) r=matklad a=duongdominhchau
PR for issue #7925
Co-authored-by: Duong Do Minh Chau <[email protected]>
Diffstat (limited to 'crates/ide_completion/src')
-rw-r--r-- | crates/ide_completion/src/completions/postfix.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/ide_completion/src/completions/postfix.rs b/crates/ide_completion/src/completions/postfix.rs index 9c34ed0b6..d45ad7944 100644 --- a/crates/ide_completion/src/completions/postfix.rs +++ b/crates/ide_completion/src/completions/postfix.rs | |||
@@ -187,6 +187,16 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) { | |||
187 | ctx, | 187 | ctx, |
188 | cap, | 188 | cap, |
189 | &dot_receiver, | 189 | &dot_receiver, |
190 | "err", | ||
191 | "Err(expr)", | ||
192 | &format!("Err({})", receiver_text), | ||
193 | ) | ||
194 | .add_to(acc); | ||
195 | |||
196 | postfix_snippet( | ||
197 | ctx, | ||
198 | cap, | ||
199 | &dot_receiver, | ||
190 | "some", | 200 | "some", |
191 | "Some(expr)", | 201 | "Some(expr)", |
192 | &format!("Some({})", receiver_text), | 202 | &format!("Some({})", receiver_text), |
@@ -325,6 +335,7 @@ fn main() { | |||
325 | sn match match expr {} | 335 | sn match match expr {} |
326 | sn box Box::new(expr) | 336 | sn box Box::new(expr) |
327 | sn ok Ok(expr) | 337 | sn ok Ok(expr) |
338 | sn err Err(expr) | ||
328 | sn some Some(expr) | 339 | sn some Some(expr) |
329 | sn dbg dbg!(expr) | 340 | sn dbg dbg!(expr) |
330 | sn dbgr dbg!(&expr) | 341 | sn dbgr dbg!(&expr) |
@@ -357,6 +368,7 @@ fn main() { | |||
357 | sn match match expr {} | 368 | sn match match expr {} |
358 | sn box Box::new(expr) | 369 | sn box Box::new(expr) |
359 | sn ok Ok(expr) | 370 | sn ok Ok(expr) |
371 | sn err Err(expr) | ||
360 | sn some Some(expr) | 372 | sn some Some(expr) |
361 | sn dbg dbg!(expr) | 373 | sn dbg dbg!(expr) |
362 | sn dbgr dbg!(&expr) | 374 | sn dbgr dbg!(&expr) |
@@ -380,6 +392,7 @@ fn main() { | |||
380 | sn match match expr {} | 392 | sn match match expr {} |
381 | sn box Box::new(expr) | 393 | sn box Box::new(expr) |
382 | sn ok Ok(expr) | 394 | sn ok Ok(expr) |
395 | sn err Err(expr) | ||
383 | sn some Some(expr) | 396 | sn some Some(expr) |
384 | sn dbg dbg!(expr) | 397 | sn dbg dbg!(expr) |
385 | sn dbgr dbg!(&expr) | 398 | sn dbgr dbg!(&expr) |
@@ -408,6 +421,7 @@ fn main() { | |||
408 | sn match match expr {} | 421 | sn match match expr {} |
409 | sn box Box::new(expr) | 422 | sn box Box::new(expr) |
410 | sn ok Ok(expr) | 423 | sn ok Ok(expr) |
424 | sn err Err(expr) | ||
411 | sn some Some(expr) | 425 | sn some Some(expr) |
412 | sn dbg dbg!(expr) | 426 | sn dbg dbg!(expr) |
413 | sn dbgr dbg!(&expr) | 427 | sn dbgr dbg!(&expr) |