diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-23 06:43:32 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-08-23 06:43:32 +0100 |
commit | e055cfacdfe3b3451484dae5d6ed08aefba133ca (patch) | |
tree | 259613dfe4b76b63966d491f03742813bfa969e9 /crates/ra_assists/src/add_missing_impl_members.rs | |
parent | 0c35d82329bc0952bd179ec37933c0955fd5ed26 (diff) | |
parent | e84f93cb5b651696637d87b98653d7e8f9149086 (diff) |
Merge #1724
1724: Refactor fill_match_arms assist to use AstBuilder facilities r=matklad a=viorina
Co-authored-by: Ekaterina Babshukova <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/add_missing_impl_members.rs')
-rw-r--r-- | crates/ra_assists/src/add_missing_impl_members.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_assists/src/add_missing_impl_members.rs b/crates/ra_assists/src/add_missing_impl_members.rs index 31c7d4e80..cbeb7054f 100644 --- a/crates/ra_assists/src/add_missing_impl_members.rs +++ b/crates/ra_assists/src/add_missing_impl_members.rs | |||
@@ -1,13 +1,14 @@ | |||
1 | use hir::{db::HirDatabase, HasSource}; | ||
2 | use ra_syntax::{ | ||
3 | ast::{self, AstNode, NameOwner}, | ||
4 | SmolStr, | ||
5 | }; | ||
6 | |||
1 | use crate::{ | 7 | use crate::{ |
2 | ast_editor::{AstBuilder, AstEditor}, | 8 | ast_editor::{AstBuilder, AstEditor}, |
3 | Assist, AssistCtx, AssistId, | 9 | Assist, AssistCtx, AssistId, |
4 | }; | 10 | }; |
5 | 11 | ||
6 | use hir::{db::HirDatabase, HasSource}; | ||
7 | use ra_db::FilePosition; | ||
8 | use ra_syntax::ast::{self, AstNode, NameOwner}; | ||
9 | use ra_syntax::SmolStr; | ||
10 | |||
11 | #[derive(PartialEq)] | 12 | #[derive(PartialEq)] |
12 | enum AddMissingImplMembersMode { | 13 | enum AddMissingImplMembersMode { |
13 | DefaultMethodsOnly, | 14 | DefaultMethodsOnly, |
@@ -43,8 +44,7 @@ fn add_missing_impl_members_inner( | |||
43 | 44 | ||
44 | let trait_def = { | 45 | let trait_def = { |
45 | let file_id = ctx.frange.file_id; | 46 | let file_id = ctx.frange.file_id; |
46 | let position = FilePosition { file_id, offset: impl_node.syntax().text_range().start() }; | 47 | let analyzer = hir::SourceAnalyzer::new(ctx.db, file_id, impl_node.syntax(), None); |
47 | let analyzer = hir::SourceAnalyzer::new(ctx.db, position.file_id, impl_node.syntax(), None); | ||
48 | 48 | ||
49 | resolve_target_trait_def(ctx.db, &analyzer, &impl_node)? | 49 | resolve_target_trait_def(ctx.db, &analyzer, &impl_node)? |
50 | }; | 50 | }; |