diff options
Diffstat (limited to 'crates/ra_assists/src/handlers/add_custom_impl.rs')
-rw-r--r-- | crates/ra_assists/src/handlers/add_custom_impl.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_assists/src/handlers/add_custom_impl.rs b/crates/ra_assists/src/handlers/add_custom_impl.rs index b67438b6b..ebdf00e67 100644 --- a/crates/ra_assists/src/handlers/add_custom_impl.rs +++ b/crates/ra_assists/src/handlers/add_custom_impl.rs | |||
@@ -1,10 +1,10 @@ | |||
1 | use itertools::Itertools; | ||
1 | use ra_syntax::{ | 2 | use ra_syntax::{ |
2 | ast::{self, AstNode}, | 3 | ast::{self, AstNode}, |
3 | Direction, SmolStr, | 4 | Direction, SmolStr, |
4 | SyntaxKind::{IDENT, WHITESPACE}, | 5 | SyntaxKind::{IDENT, WHITESPACE}, |
5 | TextRange, TextSize, | 6 | TextRange, TextSize, |
6 | }; | 7 | }; |
7 | use stdx::SepBy; | ||
8 | 8 | ||
9 | use crate::{ | 9 | use crate::{ |
10 | assist_context::{AssistContext, Assists}, | 10 | assist_context::{AssistContext, Assists}, |
@@ -61,9 +61,9 @@ pub(crate) fn add_custom_impl(acc: &mut Assists, ctx: &AssistContext) -> Option< | |||
61 | .filter(|t| t != trait_token.text()) | 61 | .filter(|t| t != trait_token.text()) |
62 | .collect::<Vec<SmolStr>>(); | 62 | .collect::<Vec<SmolStr>>(); |
63 | let has_more_derives = !new_attr_input.is_empty(); | 63 | let has_more_derives = !new_attr_input.is_empty(); |
64 | let new_attr_input = new_attr_input.iter().sep_by(", ").surround_with("(", ")").to_string(); | ||
65 | 64 | ||
66 | if has_more_derives { | 65 | if has_more_derives { |
66 | let new_attr_input = format!("({})", new_attr_input.iter().format(", ")); | ||
67 | builder.replace(input.syntax().text_range(), new_attr_input); | 67 | builder.replace(input.syntax().text_range(), new_attr_input); |
68 | } else { | 68 | } else { |
69 | let attr_range = attr.syntax().text_range(); | 69 | let attr_range = attr.syntax().text_range(); |