diff options
Diffstat (limited to 'crates/assists/src/handlers/generate_impl.rs')
-rw-r--r-- | crates/assists/src/handlers/generate_impl.rs | 11 |
1 files changed, 7 insertions, 4 deletions
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 @@ | |||
1 | use itertools::Itertools; | 1 | use itertools::Itertools; |
2 | use stdx::format_to; | 2 | use stdx::format_to; |
3 | use syntax::ast::{self, AstNode, AttrsOwner, GenericParamsOwner, NameOwner}; | 3 | use syntax::{ |
4 | ast::{self, AstNode, AttrsOwner, GenericParamsOwner, NameOwner}, | ||
5 | SmolStr, | ||
6 | }; | ||
4 | 7 | ||
5 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 8 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
6 | 9 | ||
@@ -49,16 +52,16 @@ pub(crate) fn generate_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<() | |||
49 | format_to!(buf, "{}", type_params.syntax()); | 52 | format_to!(buf, "{}", type_params.syntax()); |
50 | } | 53 | } |
51 | buf.push_str(" "); | 54 | buf.push_str(" "); |
52 | buf.push_str(name.text().as_str()); | 55 | buf.push_str(name.text()); |
53 | if let Some(type_params) = type_params { | 56 | if let Some(type_params) = type_params { |
54 | let lifetime_params = type_params | 57 | let lifetime_params = type_params |
55 | .lifetime_params() | 58 | .lifetime_params() |
56 | .filter_map(|it| it.lifetime()) | 59 | .filter_map(|it| it.lifetime()) |
57 | .map(|it| it.text().clone()); | 60 | .map(|it| SmolStr::from(it.text())); |
58 | let type_params = type_params | 61 | let type_params = type_params |
59 | .type_params() | 62 | .type_params() |
60 | .filter_map(|it| it.name()) | 63 | .filter_map(|it| it.name()) |
61 | .map(|it| it.text().clone()); | 64 | .map(|it| SmolStr::from(it.text())); |
62 | 65 | ||
63 | let generic_params = lifetime_params.chain(type_params).format(", "); | 66 | let generic_params = lifetime_params.chain(type_params).format(", "); |
64 | format_to!(buf, "<{}>", generic_params) | 67 | format_to!(buf, "<{}>", generic_params) |