aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-30 10:51:20 +0100
committerGitHub <[email protected]>2020-07-30 10:51:20 +0100
commit74864d560b9293174c82fdee2b9d15991ebf075f (patch)
treef76a250431629a36d225d456ed41f393aaa9a579 /crates/ra_assists/src
parent72ffd851dd5b0fcdf3aa072131ba11009878b4ae (diff)
parent7d09e5ed618b9b9d6e00b57b24db0b9c8a8c12d7 (diff)
Merge #5582
5582: Finish Module grammar r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/handlers/add_missing_impl_members.rs3
-rw-r--r--crates/ra_assists/src/handlers/generate_new.rs2
-rw-r--r--crates/ra_assists/src/handlers/move_bounds.rs4
-rw-r--r--crates/ra_assists/src/utils.rs3
4 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_assists/src/handlers/add_missing_impl_members.rs b/crates/ra_assists/src/handlers/add_missing_impl_members.rs
index f185e61e5..a2d9006e4 100644
--- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs
+++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs
@@ -112,7 +112,7 @@ fn add_missing_impl_members_inner(
112) -> Option<()> { 112) -> Option<()> {
113 let _p = ra_prof::profile("add_missing_impl_members_inner"); 113 let _p = ra_prof::profile("add_missing_impl_members_inner");
114 let impl_def = ctx.find_node_at_offset::<ast::ImplDef>()?; 114 let impl_def = ctx.find_node_at_offset::<ast::ImplDef>()?;
115 let impl_item_list = impl_def.item_list()?; 115 let impl_item_list = impl_def.assoc_item_list()?;
116 116
117 let trait_ = resolve_target_trait(&ctx.sema, &impl_def)?; 117 let trait_ = resolve_target_trait(&ctx.sema, &impl_def)?;
118 118
@@ -121,6 +121,7 @@ fn add_missing_impl_members_inner(
121 ast::AssocItem::FnDef(def) => def.name(), 121 ast::AssocItem::FnDef(def) => def.name(),
122 ast::AssocItem::TypeAliasDef(def) => def.name(), 122 ast::AssocItem::TypeAliasDef(def) => def.name(),
123 ast::AssocItem::ConstDef(def) => def.name(), 123 ast::AssocItem::ConstDef(def) => def.name(),
124 ast::AssocItem::MacroCall(_) => None,
124 } 125 }
125 .map(|it| it.text().clone()) 126 .map(|it| it.text().clone())
126 }; 127 };
diff --git a/crates/ra_assists/src/handlers/generate_new.rs b/crates/ra_assists/src/handlers/generate_new.rs
index e27def1d8..25bc171bf 100644
--- a/crates/ra_assists/src/handlers/generate_new.rs
+++ b/crates/ra_assists/src/handlers/generate_new.rs
@@ -158,7 +158,7 @@ fn find_struct_impl(ctx: &AssistContext, strukt: &ast::StructDef) -> Option<Opti
158} 158}
159 159
160fn has_new_fn(imp: &ast::ImplDef) -> bool { 160fn has_new_fn(imp: &ast::ImplDef) -> bool {
161 if let Some(il) = imp.item_list() { 161 if let Some(il) = imp.assoc_item_list() {
162 for item in il.assoc_items() { 162 for item in il.assoc_items() {
163 if let ast::AssocItem::FnDef(f) = item { 163 if let ast::AssocItem::FnDef(f) = item {
164 if let Some(name) = f.name() { 164 if let Some(name) = f.name() {
diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs
index ba3dafb99..6b73fff44 100644
--- a/crates/ra_assists/src/handlers/move_bounds.rs
+++ b/crates/ra_assists/src/handlers/move_bounds.rs
@@ -38,8 +38,8 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext
38 let anchor = match_ast! { 38 let anchor = match_ast! {
39 match parent { 39 match parent {
40 ast::FnDef(it) => it.body()?.syntax().clone().into(), 40 ast::FnDef(it) => it.body()?.syntax().clone().into(),
41 ast::TraitDef(it) => it.item_list()?.syntax().clone().into(), 41 ast::TraitDef(it) => it.assoc_item_list()?.syntax().clone().into(),
42 ast::ImplDef(it) => it.item_list()?.syntax().clone().into(), 42 ast::ImplDef(it) => it.assoc_item_list()?.syntax().clone().into(),
43 ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), 43 ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(),
44 ast::StructDef(it) => { 44 ast::StructDef(it) => {
45 it.syntax().children_with_tokens() 45 it.syntax().children_with_tokens()
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs
index 02de902d6..27c33df23 100644
--- a/crates/ra_assists/src/utils.rs
+++ b/crates/ra_assists/src/utils.rs
@@ -63,7 +63,7 @@ pub fn get_missing_assoc_items(
63 let mut impl_fns_consts = FxHashSet::default(); 63 let mut impl_fns_consts = FxHashSet::default();
64 let mut impl_type = FxHashSet::default(); 64 let mut impl_type = FxHashSet::default();
65 65
66 if let Some(item_list) = impl_def.item_list() { 66 if let Some(item_list) = impl_def.assoc_item_list() {
67 for item in item_list.assoc_items() { 67 for item in item_list.assoc_items() {
68 match item { 68 match item {
69 ast::AssocItem::FnDef(f) => { 69 ast::AssocItem::FnDef(f) => {
@@ -83,6 +83,7 @@ pub fn get_missing_assoc_items(
83 impl_fns_consts.insert(n.syntax().to_string()); 83 impl_fns_consts.insert(n.syntax().to_string());
84 } 84 }
85 } 85 }
86 ast::AssocItem::MacroCall(_) => (),
86 } 87 }
87 } 88 }
88 } 89 }