aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/lib.rs')
-rw-r--r--crates/ra_syntax/src/lib.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs
index ceeb2bde9..d0234cada 100644
--- a/crates/ra_syntax/src/lib.rs
+++ b/crates/ra_syntax/src/lib.rs
@@ -237,8 +237,7 @@ fn api_walkthrough() {
237 237
238 // Let's get the `1 + 1` expression! 238 // Let's get the `1 + 1` expression!
239 let body: ast::BlockExpr = func.body().unwrap(); 239 let body: ast::BlockExpr = func.body().unwrap();
240 let block = body.block().unwrap(); 240 let expr: ast::Expr = body.expr().unwrap();
241 let expr: ast::Expr = block.expr().unwrap();
242 241
243 // Enums are used to group related ast nodes together, and can be used for 242 // Enums are used to group related ast nodes together, and can be used for
244 // matching. However, because there are no public fields, it's possible to 243 // matching. However, because there are no public fields, it's possible to
@@ -274,8 +273,8 @@ fn api_walkthrough() {
274 assert_eq!(text.to_string(), "1 + 1"); 273 assert_eq!(text.to_string(), "1 + 1");
275 274
276 // There's a bunch of traversal methods on `SyntaxNode`: 275 // There's a bunch of traversal methods on `SyntaxNode`:
277 assert_eq!(expr_syntax.parent().as_ref(), Some(block.syntax())); 276 assert_eq!(expr_syntax.parent().as_ref(), Some(body.syntax()));
278 assert_eq!(block.syntax().first_child_or_token().map(|it| it.kind()), Some(T!['{'])); 277 assert_eq!(body.syntax().first_child_or_token().map(|it| it.kind()), Some(T!['{']));
279 assert_eq!( 278 assert_eq!(
280 expr_syntax.next_sibling_or_token().map(|it| it.kind()), 279 expr_syntax.next_sibling_or_token().map(|it| it.kind()),
281 Some(SyntaxKind::WHITESPACE) 280 Some(SyntaxKind::WHITESPACE)