Deduplicate some code

This commit is contained in:
Lukas Wirth 2024-02-10 01:48:41 +01:00
parent bb0de88f24
commit 2ebf0c87c2
22 changed files with 299 additions and 234 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();