diff options
Diffstat (limited to 'crates/ra_syntax/src/lib.rs')
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index 65c65d6aa..0ceabc203 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs | |||
@@ -179,10 +179,7 @@ fn api_walkthrough() { | |||
179 | 179 | ||
180 | // There's a bunch of traversal methods on `SyntaxNode`: | 180 | // There's a bunch of traversal methods on `SyntaxNode`: |
181 | assert_eq!(expr_syntax.parent(), Some(block.syntax())); | 181 | assert_eq!(expr_syntax.parent(), Some(block.syntax())); |
182 | assert_eq!( | 182 | assert_eq!(block.syntax().first_child_or_token().map(|it| it.kind()), Some(T!['{'])); |
183 | block.syntax().first_child_or_token().map(|it| it.kind()), | ||
184 | Some(SyntaxKind::L_CURLY) | ||
185 | ); | ||
186 | assert_eq!( | 183 | assert_eq!( |
187 | expr_syntax.next_sibling_or_token().map(|it| it.kind()), | 184 | expr_syntax.next_sibling_or_token().map(|it| it.kind()), |
188 | Some(SyntaxKind::WHITESPACE) | 185 | Some(SyntaxKind::WHITESPACE) |
@@ -191,9 +188,7 @@ fn api_walkthrough() { | |||
191 | // As well as some iterator helpers: | 188 | // As well as some iterator helpers: |
192 | let f = expr_syntax.ancestors().find_map(ast::FnDef::cast); | 189 | let f = expr_syntax.ancestors().find_map(ast::FnDef::cast); |
193 | assert_eq!(f, Some(&*func)); | 190 | assert_eq!(f, Some(&*func)); |
194 | assert!(expr_syntax | 191 | assert!(expr_syntax.siblings_with_tokens(Direction::Next).any(|it| it.kind() == T!['}'])); |
195 | .siblings_with_tokens(Direction::Next) | ||
196 | .any(|it| it.kind() == SyntaxKind::R_CURLY)); | ||
197 | assert_eq!( | 192 | assert_eq!( |
198 | expr_syntax.descendants_with_tokens().count(), | 193 | expr_syntax.descendants_with_tokens().count(), |
199 | 8, // 5 tokens `1`, ` `, `+`, ` `, `!` | 194 | 8, // 5 tokens `1`, ` `, `+`, ` `, `!` |