diff options
author | Domantas Jadenkus <[email protected]> | 2021-02-13 20:51:48 +0000 |
---|---|---|
committer | Domantas Jadenkus <[email protected]> | 2021-02-13 20:51:48 +0000 |
commit | 7f100fff92ab4944f3d49cf7ffdcd91fc3578936 (patch) | |
tree | 5c3de8598d60c9ec74be9f00a3affefa68ab9c04 /crates/assists/src/handlers | |
parent | 36e8a55bee478d296f3903eb4b14914914801b38 (diff) |
cargo fmt
Diffstat (limited to 'crates/assists/src/handlers')
3 files changed, 19 insertions, 9 deletions
diff --git a/crates/assists/src/handlers/generate_from_impl_for_enum.rs b/crates/assists/src/handlers/generate_from_impl_for_enum.rs index fac2447c9..d9388a737 100644 --- a/crates/assists/src/handlers/generate_from_impl_for_enum.rs +++ b/crates/assists/src/handlers/generate_from_impl_for_enum.rs | |||
@@ -3,7 +3,7 @@ use ide_db::RootDatabase; | |||
3 | use syntax::ast::{self, AstNode, NameOwner}; | 3 | use syntax::ast::{self, AstNode, NameOwner}; |
4 | use test_utils::mark; | 4 | use test_utils::mark; |
5 | 5 | ||
6 | use crate::{AssistContext, AssistId, AssistKind, Assists, utils::generate_trait_impl_text}; | 6 | use crate::{utils::generate_trait_impl_text, AssistContext, AssistId, AssistKind, Assists}; |
7 | 7 | ||
8 | // Assist: generate_from_impl_for_enum | 8 | // Assist: generate_from_impl_for_enum |
9 | // | 9 | // |
diff --git a/crates/assists/src/handlers/generate_impl.rs b/crates/assists/src/handlers/generate_impl.rs index e2762e5d2..050bcd4e2 100644 --- a/crates/assists/src/handlers/generate_impl.rs +++ b/crates/assists/src/handlers/generate_impl.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use syntax::ast::{self, AstNode, NameOwner}; | 1 | use syntax::ast::{self, AstNode, NameOwner}; |
2 | 2 | ||
3 | use crate::{AssistContext, AssistId, AssistKind, Assists, utils::generate_impl_text}; | 3 | use crate::{utils::generate_impl_text, AssistContext, AssistId, AssistKind, Assists}; |
4 | 4 | ||
5 | // Assist: generate_impl | 5 | // Assist: generate_impl |
6 | // | 6 | // |
diff --git a/crates/assists/src/handlers/replace_derive_with_manual_impl.rs b/crates/assists/src/handlers/replace_derive_with_manual_impl.rs index 7f44d752f..c69bc5cac 100644 --- a/crates/assists/src/handlers/replace_derive_with_manual_impl.rs +++ b/crates/assists/src/handlers/replace_derive_with_manual_impl.rs | |||
@@ -1,9 +1,20 @@ | |||
1 | use ide_db::helpers::mod_path_to_ast; | 1 | use ide_db::helpers::mod_path_to_ast; |
2 | use ide_db::imports_locator; | 2 | use ide_db::imports_locator; |
3 | use itertools::Itertools; | 3 | use itertools::Itertools; |
4 | use syntax::{SyntaxKind::{IDENT, WHITESPACE}, TextSize, ast::{self, AstNode, NameOwner, make}}; | 4 | use syntax::{ |
5 | 5 | ast::{self, make, AstNode, NameOwner}, | |
6 | use crate::{AssistId, AssistKind, assist_context::{AssistBuilder, AssistContext, Assists}, utils::{Cursor, DefaultMethods, add_trait_assoc_items_to_impl, filter_assoc_items, generate_trait_impl_text, render_snippet}}; | 6 | SyntaxKind::{IDENT, WHITESPACE}, |
7 | TextSize, | ||
8 | }; | ||
9 | |||
10 | use crate::{ | ||
11 | assist_context::{AssistBuilder, AssistContext, Assists}, | ||
12 | utils::{ | ||
13 | add_trait_assoc_items_to_impl, filter_assoc_items, generate_trait_impl_text, | ||
14 | render_snippet, Cursor, DefaultMethods, | ||
15 | }, | ||
16 | AssistId, AssistKind, | ||
17 | }; | ||
7 | 18 | ||
8 | // Assist: replace_derive_with_manual_impl | 19 | // Assist: replace_derive_with_manual_impl |
9 | // | 20 | // |
@@ -105,10 +116,9 @@ fn add_assist( | |||
105 | update_attribute(builder, &input, &trait_name, &attr); | 116 | update_attribute(builder, &input, &trait_name, &attr); |
106 | let trait_path = format!("{}", trait_path); | 117 | let trait_path = format!("{}", trait_path); |
107 | match (ctx.config.snippet_cap, impl_def_with_items) { | 118 | match (ctx.config.snippet_cap, impl_def_with_items) { |
108 | (None, _) => builder.insert( | 119 | (None, _) => { |
109 | insert_pos, | 120 | builder.insert(insert_pos, generate_trait_impl_text(adt, &trait_path, "")) |
110 | generate_trait_impl_text(adt, &trait_path, ""), | 121 | } |
111 | ), | ||
112 | (Some(cap), None) => builder.insert_snippet( | 122 | (Some(cap), None) => builder.insert_snippet( |
113 | cap, | 123 | cap, |
114 | insert_pos, | 124 | insert_pos, |