Rust-analyzer: if let Some / if let Ok postfix completions for Option<_> / Result<_>?

Created on 6 May 2020  路  3Comments  路  Source: rust-analyzer/rust-analyzer

When an expression has a type of Option<_> or Result<_> it would be useful to have a quick way to turn that into an

if let Some($1) = expr {
    $2
}$3

or if let Ok respectively.

E-medium

Most helpful comment

Example:

iflet

All 3 comments

Yup, I think we should add ifl postfix completion. At the moment, one can do this:

ifl

Will try to resolve it this week

Example:

iflet

Was this page helpful?
0 / 5 - 0 ratings