Auto merge of #16525 - Veykril:item-loc, r=Veykril

Abstract more over ItemTreeLoc-like structs

Allows reducing some code duplication by using functions generic over said structs. The diff isn't negative due to me adding some additional impls for completeness.
This commit is contained in:
bors 2024-02-10 10:47:37 +00:00
commit 1ef7a2329b
28 changed files with 409 additions and 413 deletions

View file

@ -668,7 +668,7 @@ fn get_assoc_item_fragment(db: &dyn HirDatabase, assoc_item: hir::AssocItem) ->
Some(match assoc_item {
AssocItem::Function(function) => {
let is_trait_method =
function.as_assoc_item(db).and_then(|assoc| assoc.containing_trait(db)).is_some();
function.as_assoc_item(db).and_then(|assoc| assoc.container_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.