aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/add_missing_impl_members.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-08-23 06:43:32 +0100
committerGitHub <[email protected]>2019-08-23 06:43:32 +0100
commite055cfacdfe3b3451484dae5d6ed08aefba133ca (patch)
tree259613dfe4b76b63966d491f03742813bfa969e9 /crates/ra_assists/src/add_missing_impl_members.rs
parent0c35d82329bc0952bd179ec37933c0955fd5ed26 (diff)
parente84f93cb5b651696637d87b98653d7e8f9149086 (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.rs14
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 @@
1use hir::{db::HirDatabase, HasSource};
2use ra_syntax::{
3 ast::{self, AstNode, NameOwner},
4 SmolStr,
5};
6
1use crate::{ 7use crate::{
2 ast_editor::{AstBuilder, AstEditor}, 8 ast_editor::{AstBuilder, AstEditor},
3 Assist, AssistCtx, AssistId, 9 Assist, AssistCtx, AssistId,
4}; 10};
5 11
6use hir::{db::HirDatabase, HasSource};
7use ra_db::FilePosition;
8use ra_syntax::ast::{self, AstNode, NameOwner};
9use ra_syntax::SmolStr;
10
11#[derive(PartialEq)] 12#[derive(PartialEq)]
12enum AddMissingImplMembersMode { 13enum 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 };