aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/introduce_variable.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/introduce_variable.rs')
-rw-r--r--crates/ra_assists/src/introduce_variable.rs5
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 @@
1use std::fmt::Write; 1use format_buf::format;
2
3use hir::db::HirDatabase; 2use hir::db::HirDatabase;
4use ra_syntax::{ 3use 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())