From 46b4f89c920c314caf1a8af2abdb09732d100d67 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Jan 2021 01:56:11 +0300 Subject: . --- crates/assists/src/handlers/generate_impl.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'crates/assists/src/handlers/generate_impl.rs') diff --git a/crates/assists/src/handlers/generate_impl.rs b/crates/assists/src/handlers/generate_impl.rs index 9af45192b..827477272 100644 --- a/crates/assists/src/handlers/generate_impl.rs +++ b/crates/assists/src/handlers/generate_impl.rs @@ -1,6 +1,9 @@ use itertools::Itertools; use stdx::format_to; -use syntax::ast::{self, AstNode, AttrsOwner, GenericParamsOwner, NameOwner}; +use syntax::{ + ast::{self, AstNode, AttrsOwner, GenericParamsOwner, NameOwner}, + SmolStr, +}; use crate::{AssistContext, AssistId, AssistKind, Assists}; @@ -49,16 +52,16 @@ pub(crate) fn generate_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<() format_to!(buf, "{}", type_params.syntax()); } buf.push_str(" "); - buf.push_str(name.text().as_str()); + buf.push_str(name.text()); if let Some(type_params) = type_params { let lifetime_params = type_params .lifetime_params() .filter_map(|it| it.lifetime()) - .map(|it| it.text().clone()); + .map(|it| SmolStr::from(it.text())); let type_params = type_params .type_params() .filter_map(|it| it.name()) - .map(|it| it.text().clone()); + .map(|it| SmolStr::from(it.text())); let generic_params = lifetime_params.chain(type_params).format(", "); format_to!(buf, "<{}>", generic_params) -- cgit v1.2.3