Skip to content

Commit cfe987b

Browse files
bors[bot]mullr
andauthored
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]>
2 parents 163ffb8 + 197d1e1 commit cfe987b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

crates/ide/src/completion/complete_postfix.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
175175
)
176176
.add_to(acc);
177177

178+
postfix_snippet(ctx, cap, &dot_receiver, "ok", "Ok(expr)", &format!("Ok({})", receiver_text))
179+
.add_to(acc);
180+
178181
postfix_snippet(
179182
ctx,
180183
cap,
@@ -277,6 +280,7 @@ fn main() {
277280
sn if if expr {}
278281
sn match match expr {}
279282
sn not !expr
283+
sn ok Ok(expr)
280284
sn ref &expr
281285
sn refm &mut expr
282286
sn while while expr {}
@@ -299,6 +303,7 @@ fn main() {
299303
sn dbg dbg!(expr)
300304
sn dbgr dbg!(&expr)
301305
sn match match expr {}
306+
sn ok Ok(expr)
302307
sn ref &expr
303308
sn refm &mut expr
304309
"#]],

0 commit comments

Comments
 (0)