File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1
1
use crate::clean::*;
2
2
3
+ /// Allows a type to traverse the cleaned ast of a crate.
4
+ ///
5
+ /// Note that like [`rustc_ast::visit::Visitor`], but
6
+ /// unlike [`rustc_lint::EarlyLintPass`], if you override a
7
+ /// `visit_*` method, you will need to manually recurse into
8
+ /// its contents.
3
9
pub(crate) trait DocVisitor<'a>: Sized {
4
10
fn visit_item(&mut self, item: &'a Item) {
5
11
self.visit_item_recur(item)
6
12
}
7
13
8
- /// don 't override!
14
+ /// Don 't override!
9
15
fn visit_inner_recur(&mut self, kind: &'a ItemKind) {
10
16
match kind {
11
17
StrippedItem(..) => unreachable!(),
@@ -46,7 +52,7 @@ pub(crate) trait DocVisitor<'a>: Sized {
46
52
}
47
53
}
48
54
49
- /// don 't override!
55
+ /// Don 't override!
50
56
fn visit_item_recur(&mut self, item: &'a Item) {
51
57
match &item.kind {
52
58
StrippedItem(i) => self.visit_inner_recur(&*i),
@@ -58,6 +64,7 @@ pub(crate) trait DocVisitor<'a>: Sized {
58
64
m.items.iter().for_each(|i| self.visit_item(i))
59
65
}
60
66
67
+ /// This is the main entrypoint of [`DocVisitor`].
61
68
fn visit_crate(&mut self, c: &'a Crate) {
62
69
self.visit_item(&c.module);
63
70
You can’t perform that action at this time.
0 commit comments