diff options
Diffstat (limited to 'crates/assists/src/handlers/generate_new.rs')
-rw-r--r-- | crates/assists/src/handlers/generate_new.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/assists/src/handlers/generate_new.rs b/crates/assists/src/handlers/generate_new.rs index 5c52b2bc8..b7390855a 100644 --- a/crates/assists/src/handlers/generate_new.rs +++ b/crates/assists/src/handlers/generate_new.rs | |||
@@ -3,7 +3,7 @@ use itertools::Itertools; | |||
3 | use stdx::format_to; | 3 | use stdx::format_to; |
4 | use syntax::{ | 4 | use syntax::{ |
5 | ast::{self, AstNode, GenericParamsOwner, NameOwner, StructKind, VisibilityOwner}, | 5 | ast::{self, AstNode, GenericParamsOwner, NameOwner, StructKind, VisibilityOwner}, |
6 | T, | 6 | SmolStr, T, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 9 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
@@ -95,14 +95,14 @@ fn generate_impl_text(strukt: &ast::Struct, code: &str) -> String { | |||
95 | format_to!(buf, "{}", type_params.syntax()); | 95 | format_to!(buf, "{}", type_params.syntax()); |
96 | } | 96 | } |
97 | buf.push_str(" "); | 97 | buf.push_str(" "); |
98 | buf.push_str(strukt.name().unwrap().text().as_str()); | 98 | buf.push_str(strukt.name().unwrap().text()); |
99 | if let Some(type_params) = type_params { | 99 | if let Some(type_params) = type_params { |
100 | let lifetime_params = type_params | 100 | let lifetime_params = type_params |
101 | .lifetime_params() | 101 | .lifetime_params() |
102 | .filter_map(|it| it.lifetime()) | 102 | .filter_map(|it| it.lifetime()) |
103 | .map(|it| it.text().clone()); | 103 | .map(|it| SmolStr::from(it.text())); |
104 | let type_params = | 104 | let type_params = |
105 | type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); | 105 | type_params.type_params().filter_map(|it| it.name()).map(|it| SmolStr::from(it.text())); |
106 | format_to!(buf, "<{}>", lifetime_params.chain(type_params).format(", ")) | 106 | format_to!(buf, "<{}>", lifetime_params.chain(type_params).format(", ")) |
107 | } | 107 | } |
108 | 108 | ||