@@ -8,7 +8,7 @@ use super::{ForeignItem, ImplItem, Item, TraitItem};
8
8
///
9
9
/// 1. **Shallow visit**: Get a simple callback for every item (or item-like thing) in the HIR.
10
10
/// - Example: find all items with a `#[foo]` attribute on them.
11
- /// - How: Implement `ItemLikeVisitor` and call `tcx.hir().krate(). visit_all_item_likes()`.
11
+ /// - How: Implement `ItemLikeVisitor` and call `tcx.hir().visit_all_item_likes()`.
12
12
/// - Pro: Efficient; just walks the lists of item-like things, not the nodes themselves.
13
13
/// - Con: Don't get information about nesting
14
14
/// - Con: Don't have methods for specific bits of HIR, like "on
@@ -19,9 +19,9 @@ use super::{ForeignItem, ImplItem, Item, TraitItem};
19
19
/// - Example: Examine each expression to look for its type and do some check or other.
20
20
/// - How: Implement `intravisit::Visitor` and override the `nested_visit_map()` method
21
21
/// to return `NestedVisitorMap::OnlyBodies` and use
22
- /// `tcx.hir().krate(). visit_all_item_likes(&mut visitor.as_deep_visitor())`. Within
23
- /// your `intravisit::Visitor` impl, implement methods like `visit_expr()` (don't forget
24
- /// to invoke `intravisit::walk_expr()` to keep walking the subparts).
22
+ /// `tcx.hir().visit_all_item_likes(&mut visitor.as_deep_visitor())`. Within your
23
+ /// `intravisit::Visitor` impl, implement methods like `visit_expr()` (don't forget to invoke
24
+ /// `intravisit::walk_expr()` to keep walking the subparts).
25
25
/// - Pro: Visitor methods for any kind of HIR node, not just item-like things.
26
26
/// - Pro: Integrates well into dependency tracking.
27
27
/// - Con: Don't get information about nesting between items
0 commit comments