mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Refactor to unify with method resolution
This commit is contained in:
parent
c7cedea270
commit
1173c3dab5
7 changed files with 117 additions and 141 deletions
|
@ -58,10 +58,12 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty)
|
|||
|
||||
fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) {
|
||||
let mut seen_methods = FxHashSet::default();
|
||||
ctx.analyzer.iterate_method_candidates(ctx.db, receiver, None, |_ty, func| {
|
||||
let data = func.data(ctx.db);
|
||||
if data.has_self_param() && seen_methods.insert(data.name().clone()) {
|
||||
acc.add_function(ctx, func);
|
||||
ctx.analyzer.iterate_method_candidates(ctx.db, receiver, None, |_ty, item| {
|
||||
if let hir::AssocItem::Function(func) = item {
|
||||
let data = func.data(ctx.db);
|
||||
if data.has_self_param() && seen_methods.insert(data.name().clone()) {
|
||||
acc.add_function(ctx, func);
|
||||
}
|
||||
}
|
||||
None::<()>
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue