aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-09-25 12:55:35 +0100
committerGitHub <[email protected]>2020-09-25 12:55:35 +0100
commitcfe987bcdfc76323805324ef440e6f164f5d19d6 (patch)
treee21d9ef32e2234307b78baf793ffbc23bc878c4a /crates/ide
parent163ffb8803e1f364701a3c2af3cd0da08de90dd5 (diff)
parent197d1e1b053b484749ac668c7219a89b1046cacd (diff)
Merge #6055
6055: Add ok postfix completion r=matklad a=mullr Wrapping values in `Ok(...)` is so pervasive that it seems reasonable for it to have its own postfix completion. Co-authored-by: Russell Mull <[email protected]>
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/completion/complete_postfix.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/ide/src/completion/complete_postfix.rs b/crates/ide/src/completion/complete_postfix.rs
index 29d38661b..26a5af5b9 100644
--- a/crates/ide/src/completion/complete_postfix.rs
+++ b/crates/ide/src/completion/complete_postfix.rs
@@ -175,6 +175,9 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
175 ) 175 )
176 .add_to(acc); 176 .add_to(acc);
177 177
178 postfix_snippet(ctx, cap, &dot_receiver, "ok", "Ok(expr)", &format!("Ok({})", receiver_text))
179 .add_to(acc);
180
178 postfix_snippet( 181 postfix_snippet(
179 ctx, 182 ctx,
180 cap, 183 cap,
@@ -277,6 +280,7 @@ fn main() {
277 sn if if expr {} 280 sn if if expr {}
278 sn match match expr {} 281 sn match match expr {}
279 sn not !expr 282 sn not !expr
283 sn ok Ok(expr)
280 sn ref &expr 284 sn ref &expr
281 sn refm &mut expr 285 sn refm &mut expr
282 sn while while expr {} 286 sn while while expr {}
@@ -299,6 +303,7 @@ fn main() {
299 sn dbg dbg!(expr) 303 sn dbg dbg!(expr)
300 sn dbgr dbg!(&expr) 304 sn dbgr dbg!(&expr)
301 sn match match expr {} 305 sn match match expr {}
306 sn ok Ok(expr)
302 sn ref &expr 307 sn ref &expr
303 sn refm &mut expr 308 sn refm &mut expr
304 "#]], 309 "#]],