From 92665358cd98913e3fef8294e1889cc0bb919e3f Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 5 May 2020 23:56:10 +0800 Subject: Rename ImplItem to AssocItem --- .../src/completion/complete_qualified_path.rs | 2 +- .../ra_ide/src/completion/complete_trait_impl.rs | 46 ++++++++++++---------- 2 files changed, 27 insertions(+), 21 deletions(-) (limited to 'crates/ra_ide/src') diff --git a/crates/ra_ide/src/completion/complete_qualified_path.rs b/crates/ra_ide/src/completion/complete_qualified_path.rs index d9ea92ef8..7fcd22525 100644 --- a/crates/ra_ide/src/completion/complete_qualified_path.rs +++ b/crates/ra_ide/src/completion/complete_qualified_path.rs @@ -84,7 +84,7 @@ pub(super) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon }); // Iterate assoc types separately - ty.iterate_impl_items(ctx.db, krate, |item| { + ty.iterate_assoc_items(ctx.db, krate, |item| { if context_module.map_or(false, |m| !item.is_visible_from(ctx.db, m)) { return None; } diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs index ee32d1ff6..039df03e0 100644 --- a/crates/ra_ide/src/completion/complete_trait_impl.rs +++ b/crates/ra_ide/src/completion/complete_trait_impl.rs @@ -32,7 +32,7 @@ //! ``` use hir::{self, Docs, HasSource}; -use ra_assists::utils::get_missing_impl_items; +use ra_assists::utils::get_missing_assoc_items; use ra_syntax::{ ast::{self, edit, ImplDef}, AstNode, SyntaxKind, SyntaxNode, TextRange, T, @@ -50,7 +50,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext if let Some((trigger, impl_def)) = completion_match(ctx) { match trigger.kind() { SyntaxKind::NAME_REF => { - get_missing_impl_items(&ctx.sema, &impl_def).iter().for_each(|item| match item { + get_missing_assoc_items(&ctx.sema, &impl_def).iter().for_each(|item| match item { hir::AssocItem::Function(fn_item) => { add_function_impl(&trigger, acc, ctx, &fn_item) } @@ -64,34 +64,40 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext } SyntaxKind::FN_DEF => { - for missing_fn in get_missing_impl_items(&ctx.sema, &impl_def).iter().filter_map( - |item| match item { - hir::AssocItem::Function(fn_item) => Some(fn_item), - _ => None, - }, - ) { + for missing_fn in + get_missing_assoc_items(&ctx.sema, &impl_def).iter().filter_map(|item| { + match item { + hir::AssocItem::Function(fn_item) => Some(fn_item), + _ => None, + } + }) + { add_function_impl(&trigger, acc, ctx, &missing_fn); } } SyntaxKind::TYPE_ALIAS_DEF => { - for missing_fn in get_missing_impl_items(&ctx.sema, &impl_def).iter().filter_map( - |item| match item { - hir::AssocItem::TypeAlias(type_item) => Some(type_item), - _ => None, - }, - ) { + for missing_fn in + get_missing_assoc_items(&ctx.sema, &impl_def).iter().filter_map(|item| { + match item { + hir::AssocItem::TypeAlias(type_item) => Some(type_item), + _ => None, + } + }) + { add_type_alias_impl(&trigger, acc, ctx, &missing_fn); } } SyntaxKind::CONST_DEF => { - for missing_fn in get_missing_impl_items(&ctx.sema, &impl_def).iter().filter_map( - |item| match item { - hir::AssocItem::Const(const_item) => Some(const_item), - _ => None, - }, - ) { + for missing_fn in + get_missing_assoc_items(&ctx.sema, &impl_def).iter().filter_map(|item| { + match item { + hir::AssocItem::Const(const_item) => Some(const_item), + _ => None, + } + }) + { add_const_impl(&trigger, acc, ctx, &missing_fn); } } -- cgit v1.2.3