mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
More symbol usage
This commit is contained in:
parent
c30bdfcc84
commit
df5f1777b8
50 changed files with 388 additions and 303 deletions
|
@ -1,7 +1,7 @@
|
|||
//! Code common to structs, unions, and enum variants.
|
||||
|
||||
use crate::context::CompletionContext;
|
||||
use hir::{db::HirDatabase, HasAttrs, HasCrate, HasVisibility, HirDisplay, StructKind};
|
||||
use hir::{db::HirDatabase, sym, HasAttrs, HasCrate, HasVisibility, HirDisplay, StructKind};
|
||||
use ide_db::SnippetCap;
|
||||
use itertools::Itertools;
|
||||
use syntax::SmolStr;
|
||||
|
@ -86,7 +86,7 @@ pub(crate) fn visible_fields(
|
|||
.copied()
|
||||
.collect::<Vec<_>>();
|
||||
let has_invisible_field = n_fields - fields.len() > 0;
|
||||
let is_foreign_non_exhaustive = item.attrs(ctx.db).by_key("non_exhaustive").exists()
|
||||
let is_foreign_non_exhaustive = item.attrs(ctx.db).by_key(&sym::non_exhaustive).exists()
|
||||
&& item.krate(ctx.db) != module.krate();
|
||||
let fields_omitted = has_invisible_field || is_foreign_non_exhaustive;
|
||||
Some((fields, fields_omitted))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue