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 <russell.mull@gmail.com>
This commit is contained in:
bors[bot] 2020-09-25 11:55:35 +00:00 committed by GitHub
commit cfe987bcdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,6 +175,9 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
)
.add_to(acc);
postfix_snippet(ctx, cap, &dot_receiver, "ok", "Ok(expr)", &format!("Ok({})", receiver_text))
.add_to(acc);
postfix_snippet(
ctx,
cap,
@ -277,6 +280,7 @@ fn main() {
sn if if expr {}
sn match match expr {}
sn not !expr
sn ok Ok(expr)
sn ref &expr
sn refm &mut expr
sn while while expr {}
@ -299,6 +303,7 @@ fn main() {
sn dbg dbg!(expr)
sn dbgr dbg!(&expr)
sn match match expr {}
sn ok Ok(expr)
sn ref &expr
sn refm &mut expr
"#]],