mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 08:36:03 +00:00
Move ItemEnum → Generics logic into method on ItemEnum.
This commit is contained in:
parent
012f45eaf7
commit
28ecfb691d
@ -380,6 +380,23 @@ pub enum ItemEnum {
|
||||
StrippedItem(Box<ItemEnum>),
|
||||
}
|
||||
|
||||
impl ItemEnum {
|
||||
pub fn generics(&self) -> Option<&Generics> {
|
||||
Some(match *self {
|
||||
ItemEnum::StructItem(ref s) => &s.generics,
|
||||
ItemEnum::EnumItem(ref e) => &e.generics,
|
||||
ItemEnum::FunctionItem(ref f) => &f.generics,
|
||||
ItemEnum::TypedefItem(ref t, _) => &t.generics,
|
||||
ItemEnum::TraitItem(ref t) => &t.generics,
|
||||
ItemEnum::ImplItem(ref i) => &i.generics,
|
||||
ItemEnum::TyMethodItem(ref i) => &i.generics,
|
||||
ItemEnum::MethodItem(ref i) => &i.generics,
|
||||
ItemEnum::ForeignFunctionItem(ref f) => &f.generics,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||
pub struct Module {
|
||||
pub items: Vec<Item>,
|
||||
|
@ -997,17 +997,8 @@ impl DocFolder for Cache {
|
||||
|
||||
// Register any generics to their corresponding string. This is used
|
||||
// when pretty-printing types
|
||||
match item.inner {
|
||||
clean::StructItem(ref s) => self.generics(&s.generics),
|
||||
clean::EnumItem(ref e) => self.generics(&e.generics),
|
||||
clean::FunctionItem(ref f) => self.generics(&f.generics),
|
||||
clean::TypedefItem(ref t, _) => self.generics(&t.generics),
|
||||
clean::TraitItem(ref t) => self.generics(&t.generics),
|
||||
clean::ImplItem(ref i) => self.generics(&i.generics),
|
||||
clean::TyMethodItem(ref i) => self.generics(&i.generics),
|
||||
clean::MethodItem(ref i) => self.generics(&i.generics),
|
||||
clean::ForeignFunctionItem(ref f) => self.generics(&f.generics),
|
||||
_ => {}
|
||||
if let Some(generics) = item.inner.generics() {
|
||||
self.generics(generics);
|
||||
}
|
||||
|
||||
if !self.seen_mod {
|
||||
|
Loading…
Reference in New Issue
Block a user