convenience api

This commit is contained in:
Aleksey Kladov 2019-07-19 19:05:34 +03:00
parent a6df224f7d
commit 191a6ba330
8 changed files with 63 additions and 50 deletions

View file

@ -156,7 +156,7 @@ fn extend_list_item(node: &SyntaxNode) -> Option<TextRange> {
SyntaxElement::Token(it) => is_single_line_ws(it),
})
.next()
.and_then(|it| it.as_token().cloned())
.and_then(|it| it.into_token())
.filter(|node| node.kind() == T![,])
}
@ -167,7 +167,7 @@ fn extend_list_item(node: &SyntaxNode) -> Option<TextRange> {
// Include any following whitespace when comma if after list item.
let final_node = comma_node
.next_sibling_or_token()
.and_then(|it| it.as_token().cloned())
.and_then(|it| it.into_token())
.filter(|node| is_single_line_ws(node))
.unwrap_or(comma_node);