From 4f2134cc33f07c09fe166cec42971828843bc0ef Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 2 May 2020 01:18:19 +0200 Subject: Introduce EffectExpr --- crates/ra_syntax/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'crates/ra_syntax/src/lib.rs') 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() { // Let's get the `1 + 1` expression! let body: ast::BlockExpr = func.body().unwrap(); - let block = body.block().unwrap(); - let expr: ast::Expr = block.expr().unwrap(); + let expr: ast::Expr = body.expr().unwrap(); // Enums are used to group related ast nodes together, and can be used for // matching. However, because there are no public fields, it's possible to @@ -274,8 +273,8 @@ fn api_walkthrough() { assert_eq!(text.to_string(), "1 + 1"); // There's a bunch of traversal methods on `SyntaxNode`: - assert_eq!(expr_syntax.parent().as_ref(), Some(block.syntax())); - assert_eq!(block.syntax().first_child_or_token().map(|it| it.kind()), Some(T!['{'])); + assert_eq!(expr_syntax.parent().as_ref(), Some(body.syntax())); + assert_eq!(body.syntax().first_child_or_token().map(|it| it.kind()), Some(T!['{'])); assert_eq!( expr_syntax.next_sibling_or_token().map(|it| it.kind()), Some(SyntaxKind::WHITESPACE) -- cgit v1.2.3