mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Complete associated consts in patterns
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
This commit is contained in:
parent
98143da799
commit
37d0c722ef
1 changed files with 12 additions and 5 deletions
|
@ -165,13 +165,20 @@ fn pattern_path_completion(
|
||||||
ctx.module,
|
ctx.module,
|
||||||
None,
|
None,
|
||||||
|item| {
|
|item| {
|
||||||
// Note associated consts cannot be referenced in patterns
|
match item {
|
||||||
if let AssocItem::TypeAlias(ta) = item {
|
AssocItem::TypeAlias(ta) => {
|
||||||
// We might iterate candidates of a trait multiple times here, so deduplicate them.
|
// We might iterate candidates of a trait multiple times here, so deduplicate them.
|
||||||
if seen.insert(item) {
|
if seen.insert(item) {
|
||||||
acc.add_type_alias(ctx, ta);
|
acc.add_type_alias(ctx, ta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AssocItem::Const(c) => {
|
||||||
|
if seen.insert(item) {
|
||||||
|
acc.add_const(ctx, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
None::<()>
|
None::<()>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue