Skip to content

Commit

Permalink
Teach tools that macros are now HIR items
Browse files Browse the repository at this point in the history
  • Loading branch information
inquisitivecrystal committed Aug 28, 2021
1 parent 8c4056f commit c8262ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/missing_doc.rs
Expand Up @@ -122,8 +122,8 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
},
hir::ItemKind::Const(..)
| hir::ItemKind::Enum(..)
| hir::ItemKind::Mod(..)
| hir::ItemKind::Macro(..)
| hir::ItemKind::Mod(..)
| hir::ItemKind::Static(..)
| hir::ItemKind::Struct(..)
| hir::ItemKind::Trait(..)
Expand Down
1 change: 1 addition & 0 deletions clippy_lints/src/missing_inline.rs
Expand Up @@ -118,6 +118,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
},
hir::ItemKind::Const(..)
| hir::ItemKind::Enum(..)
| hir::ItemKind::Macro(..)
| hir::ItemKind::Mod(..)
| hir::ItemKind::Static(..)
| hir::ItemKind::Struct(..)
Expand Down
7 changes: 7 additions & 0 deletions clippy_lints/src/utils/inspector.rs
Expand Up @@ -381,6 +381,13 @@ fn print_item(cx: &LateContext<'_>, item: &hir::Item<'_>) {
let item_ty = cx.tcx.type_of(did);
println!("function of type {:#?}", item_ty);
},
hir::ItemKind::Macro(ref macro_def) => {
if macro_def.macro_rules {
println!("macro introduced by `macro_rules!`");
} else {
println!("macro introduced by `macro`");
}
},
hir::ItemKind::Mod(..) => println!("module"),
hir::ItemKind::ForeignMod { abi, .. } => println!("foreign module with abi: {}", abi),
hir::ItemKind::GlobalAsm(asm) => println!("global asm: {:?}", asm),
Expand Down

0 comments on commit c8262ad

Please sign in to comment.