diff options
author | Aleksey Kladov <[email protected]> | 2019-07-19 17:05:34 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-19 17:05:34 +0100 |
commit | 191a6ba330bd47fc3b9cc05d59b2d456b471eb89 (patch) | |
tree | 9c7996d6ac7323da527fb53171b9275545d1640a /crates/ra_assists/src | |
parent | a6df224f7d3893f5a742b58818eac6c5a953721d (diff) |
convenience api
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/ast_editor.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs index 5fbcadfee..a35334d7e 100644 --- a/crates/ra_assists/src/ast_editor.rs +++ b/crates/ra_assists/src/ast_editor.rs | |||
@@ -299,7 +299,7 @@ mod tokens { | |||
299 | .tree() | 299 | .tree() |
300 | .syntax() | 300 | .syntax() |
301 | .descendants_with_tokens() | 301 | .descendants_with_tokens() |
302 | .filter_map(|it| it.as_token().cloned()) | 302 | .filter_map(|it| it.into_token()) |
303 | .find(|it| it.kind() == T![,]) | 303 | .find(|it| it.kind() == T![,]) |
304 | .unwrap() | 304 | .unwrap() |
305 | } | 305 | } |
@@ -309,7 +309,7 @@ mod tokens { | |||
309 | .tree() | 309 | .tree() |
310 | .syntax() | 310 | .syntax() |
311 | .descendants_with_tokens() | 311 | .descendants_with_tokens() |
312 | .filter_map(|it| it.as_token().cloned()) | 312 | .filter_map(|it| it.into_token()) |
313 | .find(|it| it.kind() == WHITESPACE && it.text().as_str() == " ") | 313 | .find(|it| it.kind() == WHITESPACE && it.text().as_str() == " ") |
314 | .unwrap() | 314 | .unwrap() |
315 | } | 315 | } |
@@ -320,7 +320,7 @@ mod tokens { | |||
320 | .tree() | 320 | .tree() |
321 | .syntax() | 321 | .syntax() |
322 | .descendants_with_tokens() | 322 | .descendants_with_tokens() |
323 | .filter_map(|it| it.as_token().cloned()) | 323 | .filter_map(|it| it.into_token()) |
324 | .find(|it| it.kind() == WHITESPACE && it.text().as_str() == "\n") | 324 | .find(|it| it.kind() == WHITESPACE && it.text().as_str() == "\n") |
325 | .unwrap() | 325 | .unwrap() |
326 | } | 326 | } |
@@ -332,7 +332,7 @@ mod tokens { | |||
332 | WsBuilder(SourceFile::parse(text).ok().unwrap()) | 332 | WsBuilder(SourceFile::parse(text).ok().unwrap()) |
333 | } | 333 | } |
334 | pub(crate) fn ws(&self) -> SyntaxToken { | 334 | pub(crate) fn ws(&self) -> SyntaxToken { |
335 | self.0.syntax().first_child_or_token().unwrap().as_token().cloned().unwrap() | 335 | self.0.syntax().first_child_or_token().unwrap().into_token().unwrap() |
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||