diff options
author | Conrad Ludgate <[email protected]> | 2021-03-01 11:21:02 +0000 |
---|---|---|
committer | Conrad Ludgate <[email protected]> | 2021-03-02 14:30:10 +0000 |
commit | 218390b9fb0cfa713d4b6b38425f3a07fee2b564 (patch) | |
tree | 7a1a894fc4b17bcf7774535d8781cc011e5e3247 | |
parent | 705712993ffe24898e3c1fe006e1108b7d02d6bc (diff) |
chore: rename var
-rw-r--r-- | crates/ide_assists/src/handlers/add_type_ascription.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ide_assists/src/handlers/add_type_ascription.rs b/crates/ide_assists/src/handlers/add_type_ascription.rs index e9dc37150..ea9f249d3 100644 --- a/crates/ide_assists/src/handlers/add_type_ascription.rs +++ b/crates/ide_assists/src/handlers/add_type_ascription.rs | |||
@@ -30,6 +30,7 @@ pub(crate) fn add_type_ascription(acc: &mut Assists, ctx: &AssistContext) -> Opt | |||
30 | mark::hit!(add_type_ascription_already_typed); | 30 | mark::hit!(add_type_ascription_already_typed); |
31 | return None | 31 | return None |
32 | } | 32 | } |
33 | let type_pos = let_stmt.pat()?.syntax().last_token()?.text_range().end(); | ||
33 | 34 | ||
34 | let ident = ctx.find_token_syntax_at_offset(SyntaxKind::IDENT).or_else(|| { | 35 | let ident = ctx.find_token_syntax_at_offset(SyntaxKind::IDENT).or_else(|| { |
35 | let arg_list = ctx.find_node_at_offset::<ast::ArgList>()?; | 36 | let arg_list = ctx.find_node_at_offset::<ast::ArgList>()?; |
@@ -58,14 +59,13 @@ pub(crate) fn add_type_ascription(acc: &mut Assists, ctx: &AssistContext) -> Opt | |||
58 | mark::hit!(add_type_ascription_non_generic); | 59 | mark::hit!(add_type_ascription_non_generic); |
59 | return None; | 60 | return None; |
60 | } | 61 | } |
61 | let pat = let_stmt.pat()?.syntax().last_token()?.text_range().end(); | ||
62 | acc.add( | 62 | acc.add( |
63 | AssistId("add_type_ascription", AssistKind::RefactorRewrite), | 63 | AssistId("add_type_ascription", AssistKind::RefactorRewrite), |
64 | "Add `: _` before assignment operator", | 64 | "Add `: _` before assignment operator", |
65 | ident.text_range(), | 65 | ident.text_range(), |
66 | |builder| match ctx.config.snippet_cap { | 66 | |builder| match ctx.config.snippet_cap { |
67 | Some(cap) => builder.insert_snippet(cap, pat, ": ${0:_}"), | 67 | Some(cap) => builder.insert_snippet(cap, type_pos, ": ${0:_}"), |
68 | None => builder.insert(pat, ": _"), | 68 | None => builder.insert(type_pos, ": _"), |
69 | }, | 69 | }, |
70 | ) | 70 | ) |
71 | } | 71 | } |