mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Add flyimport completion for trait assoc items
This commit is contained in:
parent
9a349f280f
commit
db335a1bbf
18 changed files with 661 additions and 247 deletions
|
@ -438,10 +438,10 @@ fn get_symbol_fragment(db: &dyn HirDatabase, field_or_assoc: &FieldOrAssocItem)
|
|||
FieldOrAssocItem::Field(field) => format!("#structfield.{}", field.name(db)),
|
||||
FieldOrAssocItem::AssocItem(assoc) => match assoc {
|
||||
AssocItem::Function(function) => {
|
||||
let is_trait_method = matches!(
|
||||
function.as_assoc_item(db).map(|assoc| assoc.container(db)),
|
||||
Some(AssocItemContainer::Trait(..))
|
||||
);
|
||||
let is_trait_method = function
|
||||
.as_assoc_item(db)
|
||||
.and_then(|assoc| assoc.containing_trait(db))
|
||||
.is_some();
|
||||
// This distinction may get more complicated when specialization is available.
|
||||
// Rustdoc makes this decision based on whether a method 'has defaultness'.
|
||||
// Currently this is only the case for provided trait methods.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue