aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkjeremy <[email protected]>2019-10-30 18:38:45 +0000
committerkjeremy <[email protected]>2019-10-30 18:38:45 +0000
commit7ad55e976c3f88e92075379c8a4c1f413665b458 (patch)
treeac6407fba56558cab3023fefcda96f50290131ad
parenteee55d4663084a01ce80f5ee201d8e1e345417cd (diff)
Document match_ast!
-rw-r--r--crates/ra_syntax/src/lib.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs
index c315ba552..5dcb6a95a 100644
--- a/crates/ra_syntax/src/lib.rs
+++ b/crates/ra_syntax/src/lib.rs
@@ -160,6 +160,20 @@ impl SourceFile {
160 } 160 }
161} 161}
162 162
163/// Matches a `SyntaxNode` against an `ast` type.
164///
165/// # Example:
166///
167/// ```ignore
168/// match_ast! {
169/// match node {
170/// ast::CallExpr(it) => { ... },
171/// ast::MethodCallExpr(it) => { ... },
172/// ast::MacroCall(it) => { ... },
173/// _ => None,
174/// }
175/// }
176/// ```
163#[macro_export] 177#[macro_export]
164macro_rules! match_ast { 178macro_rules! match_ast {
165 (match $node:ident { 179 (match $node:ident {