- Res::Def(DefKind::Macro(mac_kind), i) => match mac_kind {
- MacroKind::Bang => (i, ItemType::Macro),
- MacroKind::Attr => (i, ItemType::ProcAttribute),
- MacroKind::Derive => (i, ItemType::ProcDerive),
- },
- Res::Def(DefKind::TraitAlias, i) => (i, ItemType::TraitAlias),
- Res::SelfTy(Some(def_id), _) => (def_id, ItemType::Trait),
- Res::SelfTy(_, Some((impl_def_id, _))) => return impl_def_id,
- _ => return res.def_id(),
+ // Each of these have their own page.
+ Res::Def(
+ kind
+ @
+ (Fn | TyAlias | Enum | Trait | Struct | Union | Mod | ForeignTy | Const | Static
+ | Macro(..) | TraitAlias),
+ i,
+ ) => (i, kind.into()),
+ // This is part of a trait definition; document the trait.
+ Res::SelfTy(Some(trait_def_id), _) => (trait_def_id, ItemType::Trait),
+ // This is an inherent impl; it doesn't have its own page.
+ Res::SelfTy(None, Some((impl_def_id, _))) => return impl_def_id,
+ Res::SelfTy(None, None)
+ | Res::PrimTy(_)
+ | Res::ToolMod
+ | Res::SelfCtor(_)
+ | Res::Local(_)
+ | Res::NonMacroAttr(_)
+ | Res::Err => return res.def_id(),
+ Res::Def(
+ TyParam | ConstParam | Ctor(..) | ExternCrate | Use | ForeignMod | AnonConst | OpaqueTy
+ | Field | LifetimeParam | GlobalAsm | Impl | Closure | Generator,
+ id,
+ ) => return id,