diff options
author | Benjamin Coenen <[email protected]> | 2020-05-02 11:25:04 +0100 |
---|---|---|
committer | Benjamin Coenen <[email protected]> | 2020-05-02 11:25:04 +0100 |
commit | 0b40876b993ab30421624b831cb03b4042eb0142 (patch) | |
tree | 85abb233dd8645480d61ab857a2b46c1209b142a /crates/ra_syntax/src/lib.rs | |
parent | eea21738ab9e0b7438d03f7b2efc18c15cc30cf2 (diff) | |
parent | 75bc0249463b72971200e482d69dad88d4e76ae3 (diff) |
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer
Diffstat (limited to 'crates/ra_syntax/src/lib.rs')
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 7 |
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) |