From 0146a95a3987bc8d1f68fddfc39e8a5458feae0d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 19 May 2020 21:40:47 +0200 Subject: Cleanup --- crates/ra_assists/src/handlers/add_explicit_type.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crates/ra_assists') diff --git a/crates/ra_assists/src/handlers/add_explicit_type.rs b/crates/ra_assists/src/handlers/add_explicit_type.rs index 0c7d5e355..770049212 100644 --- a/crates/ra_assists/src/handlers/add_explicit_type.rs +++ b/crates/ra_assists/src/handlers/add_explicit_type.rs @@ -25,9 +25,8 @@ pub(crate) fn add_explicit_type(acc: &mut Assists, ctx: &AssistContext) -> Optio let stmt = ctx.find_node_at_offset::()?; let module = ctx.sema.scope(stmt.syntax()).module()?; let expr = stmt.initializer()?; - let pat = stmt.pat()?; // Must be a binding - let pat = match pat { + let pat = match stmt.pat()? { ast::Pat::BindPat(bind_pat) => bind_pat, _ => return None, }; @@ -46,7 +45,7 @@ pub(crate) fn add_explicit_type(acc: &mut Assists, ctx: &AssistContext) -> Optio // Assist not applicable if the type has already been specified // and it has no placeholders let ascribed_ty = stmt.ascribed_type(); - if let Some(ref ty) = ascribed_ty { + if let Some(ty) = &ascribed_ty { if ty.syntax().descendants().find_map(ast::PlaceholderType::cast).is_none() { return None; } -- cgit v1.2.3