From 191a6ba330bd47fc3b9cc05d59b2d456b471eb89 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 19 Jul 2019 19:05:34 +0300 Subject: convenience api --- crates/ra_assists/src/ast_editor.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_assists/src') 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 { .tree() .syntax() .descendants_with_tokens() - .filter_map(|it| it.as_token().cloned()) + .filter_map(|it| it.into_token()) .find(|it| it.kind() == T![,]) .unwrap() } @@ -309,7 +309,7 @@ mod tokens { .tree() .syntax() .descendants_with_tokens() - .filter_map(|it| it.as_token().cloned()) + .filter_map(|it| it.into_token()) .find(|it| it.kind() == WHITESPACE && it.text().as_str() == " ") .unwrap() } @@ -320,7 +320,7 @@ mod tokens { .tree() .syntax() .descendants_with_tokens() - .filter_map(|it| it.as_token().cloned()) + .filter_map(|it| it.into_token()) .find(|it| it.kind() == WHITESPACE && it.text().as_str() == "\n") .unwrap() } @@ -332,7 +332,7 @@ mod tokens { WsBuilder(SourceFile::parse(text).ok().unwrap()) } pub(crate) fn ws(&self) -> SyntaxToken { - self.0.syntax().first_child_or_token().unwrap().as_token().cloned().unwrap() + self.0.syntax().first_child_or_token().unwrap().into_token().unwrap() } } -- cgit v1.2.3