From f6bcc2d7459a3e10090391a6f9b9a2789e9cab55 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 20 Jul 2019 16:52:11 +0300 Subject: align SyntaxText API with upstream --- crates/ra_assists/src/introduce_variable.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crates/ra_assists/src/introduce_variable.rs') diff --git a/crates/ra_assists/src/introduce_variable.rs b/crates/ra_assists/src/introduce_variable.rs index df6c58989..911de2d48 100644 --- a/crates/ra_assists/src/introduce_variable.rs +++ b/crates/ra_assists/src/introduce_variable.rs @@ -1,3 +1,5 @@ +use std::fmt::Write; + use hir::db::HirDatabase; use ra_syntax::{ ast::{self, AstNode}, @@ -35,8 +37,7 @@ pub(crate) fn introduce_variable(mut ctx: AssistCtx) -> Option buf.push_str("let var_name = "); TextUnit::of_str("let ") }; - - expr.syntax().text().push_to(&mut buf); + write!(buf, "{}", expr.syntax()).unwrap(); let full_stmt = ast::ExprStmt::cast(anchor_stmt.clone()); let is_full_stmt = if let Some(expr_stmt) = &full_stmt { Some(expr.syntax().clone()) == expr_stmt.expr().map(|e| e.syntax().clone()) -- cgit v1.2.3