fix: Don't add braces to 'if' completion in match guard position

When the cursor is in a match arm, but before the fat arrow (=>) token, don't
add braces when autocompleting "if".

fixes #12823
This commit is contained in:
Dorian Scheidt 2022-07-22 19:06:14 -05:00
parent 0b131bc78e
commit 13c83f90ac
4 changed files with 88 additions and 1 deletions

View file

@ -138,6 +138,9 @@ pub(crate) struct ExprCtx {
pub(crate) self_param: Option<hir::SelfParam>,
pub(crate) innermost_ret_ty: Option<hir::Type>,
pub(crate) impl_: Option<ast::Impl>,
/// Whether this expression occurs in match arm guard position: before the
/// fat arrow token
pub(crate) in_match_guard: bool,
}
/// Original file ast nodes