Flatten ItemKind into an Item enum
Side note: this pattern is sort of nice:
let item: &Item = /* ... */;
match *item {
Item::Mod(ref item) => {
do_something_with(&item.ident, &item.content);
}
Item::Fn(ref item) => {
do_something_with(&item.abi, &item.block);
}
/* ... */
}
Basically pattern matching on an `item` and rebinding the same name `item`
just takes your variable and imbues it with those additional fields that exist
on the type of item that it happens to be.
diff --git a/src/lib.rs b/src/lib.rs
index 2e20825..132f8dc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -53,9 +53,9 @@
mod item;
#[cfg(feature = "full")]
pub use item::{Constness, Defaultness, FnArg, FnDecl, ForeignItemKind, ForeignItem, ItemForeignMod,
- ImplItem, ImplItemKind, ImplPolarity, Item, ItemKind, MethodSig, PathListItem,
+ ImplItem, ImplItemKind, ImplPolarity, Item, MethodSig, PathListItem,
TraitItem, TraitItemKind, ViewPath, ItemExternCrate, ItemUse,
- ItemStatic, ItemConst, ItemFn, ItemMod, ItemTy, ItemEnum,
+ ItemStatic, ItemConst, ItemFn, ItemMac, ItemMod, ItemTy, ItemEnum,
ItemStruct, ItemUnion, ItemTrait, ItemDefaultImpl, ItemImpl,
PathSimple, PathGlob, PathList, ForeignItemFn, ForeignItemStatic,
TraitItemConst, TraitItemMethod, TraitItemType,