mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
simplify
This commit is contained in:
parent
5887c0e574
commit
2369af8c82
1 changed files with 31 additions and 31 deletions
|
@ -1,4 +1,4 @@
|
||||||
use hir::{Resolution};
|
use hir::Resolution;
|
||||||
use ra_syntax::{AstNode, ast::NameOwner};
|
use ra_syntax::{AstNode, ast::NameOwner};
|
||||||
use test_utils::tested_by;
|
use test_utils::tested_by;
|
||||||
|
|
||||||
|
@ -44,13 +44,13 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
|
||||||
}
|
}
|
||||||
hir::ModuleDef::Struct(s) => {
|
hir::ModuleDef::Struct(s) => {
|
||||||
let ty = s.ty(ctx.db);
|
let ty = s.ty(ctx.db);
|
||||||
ty.iterate_impl_items(ctx.db, |item| match item {
|
ty.iterate_impl_items(ctx.db, |item| {
|
||||||
|
match item {
|
||||||
hir::ImplItem::Method(func) => {
|
hir::ImplItem::Method(func) => {
|
||||||
let sig = func.signature(ctx.db);
|
let sig = func.signature(ctx.db);
|
||||||
if !sig.has_self_param() {
|
if !sig.has_self_param() {
|
||||||
acc.add_function(ctx, func);
|
acc.add_function(ctx, func);
|
||||||
}
|
}
|
||||||
None::<()>
|
|
||||||
}
|
}
|
||||||
hir::ImplItem::Const(ct) => {
|
hir::ImplItem::Const(ct) => {
|
||||||
let source = ct.source(ctx.db);
|
let source = ct.source(ctx.db);
|
||||||
|
@ -63,7 +63,6 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
|
||||||
.from_const(ctx, ct)
|
.from_const(ctx, ct)
|
||||||
.add_to(acc);
|
.add_to(acc);
|
||||||
}
|
}
|
||||||
None::<()>
|
|
||||||
}
|
}
|
||||||
hir::ImplItem::Type(ty) => {
|
hir::ImplItem::Type(ty) => {
|
||||||
let source = ty.source(ctx.db);
|
let source = ty.source(ctx.db);
|
||||||
|
@ -76,8 +75,9 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
|
||||||
.from_type(ctx, ty)
|
.from_type(ctx, ty)
|
||||||
.add_to(acc);
|
.add_to(acc);
|
||||||
}
|
}
|
||||||
None::<()>
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
None::<()>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_ => return,
|
_ => return,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue