diff options
author | Aleksey Kladov <[email protected]> | 2019-07-20 18:04:34 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-20 18:12:06 +0100 |
commit | c9cfd57eeaa53657c0af7b9c4ba74d6b7b9889ed (patch) | |
tree | 422c1d8fb7f8af663df3c6c6183783253692acad /crates/ra_assists/src/introduce_variable.rs | |
parent | 7bde8012cb28c44de7ffc779003781d385323808 (diff) |
switch to upstream rowan's API
Diffstat (limited to 'crates/ra_assists/src/introduce_variable.rs')
-rw-r--r-- | crates/ra_assists/src/introduce_variable.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/ra_assists/src/introduce_variable.rs b/crates/ra_assists/src/introduce_variable.rs index 911de2d48..5eb708310 100644 --- a/crates/ra_assists/src/introduce_variable.rs +++ b/crates/ra_assists/src/introduce_variable.rs | |||
@@ -1,5 +1,4 @@ | |||
1 | use std::fmt::Write; | 1 | use format_buf::format; |
2 | |||
3 | use hir::db::HirDatabase; | 2 | use hir::db::HirDatabase; |
4 | use ra_syntax::{ | 3 | use ra_syntax::{ |
5 | ast::{self, AstNode}, | 4 | ast::{self, AstNode}, |
@@ -37,7 +36,7 @@ pub(crate) fn introduce_variable(mut ctx: AssistCtx<impl HirDatabase>) -> Option | |||
37 | buf.push_str("let var_name = "); | 36 | buf.push_str("let var_name = "); |
38 | TextUnit::of_str("let ") | 37 | TextUnit::of_str("let ") |
39 | }; | 38 | }; |
40 | write!(buf, "{}", expr.syntax()).unwrap(); | 39 | format!(buf, "{}", expr.syntax()); |
41 | let full_stmt = ast::ExprStmt::cast(anchor_stmt.clone()); | 40 | let full_stmt = ast::ExprStmt::cast(anchor_stmt.clone()); |
42 | let is_full_stmt = if let Some(expr_stmt) = &full_stmt { | 41 | let is_full_stmt = if let Some(expr_stmt) = &full_stmt { |
43 | Some(expr.syntax().clone()) == expr_stmt.expr().map(|e| e.syntax().clone()) | 42 | Some(expr.syntax().clone()) == expr_stmt.expr().map(|e| e.syntax().clone()) |