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

@ -442,8 +442,7 @@ fn module_def_doctest(db: &RootDatabase, def: Definition) -> Option<Runnable> {
.for_each(|name| format_to!(path, "{}::", name.display(db)));
// This probably belongs to canonical_path?
if let Some(assoc_item) = def.as_assoc_item(db) {
if let hir::AssocItemContainer::Impl(imp) = assoc_item.container(db) {
let ty = imp.self_ty(db);
if let Some(ty) = assoc_item.implementing_ty(db) {
if let Some(adt) = ty.as_adt() {
let name = adt.name(db);
let mut ty_args = ty.generic_parameters(db).peekable();