Expand description
AST traversal via the visitor pattern.
The design mirrors rustc/syn: the Visitor trait provides visit_*
methods whose default implementations recurse by delegating to the free
walk_* functions. A visitor overrides only the node kinds it cares about,
and calls the matching walk_* (or walk_expr/walk_stmt) to keep
descending into children. The traversal shape lives here, written once, so
individual lint passes never re-implement tree-walking.
All methods take &mut self so a pass can accumulate state (e.g. collected
diagnostics) as it walks. The ?Sized bounds on the walk_* functions let
them drive a dyn Visitor, which the lint driver relies on.
Traits§
- Visitor
- A read-only traversal over the AST.