Make replace_derive_with_manual_impl work again

This commit is contained in:
Lukas Wirth 2022-02-21 12:57:57 +01:00
parent be3168dabe
commit f13c98034b
9 changed files with 118 additions and 130 deletions

View file

@ -705,6 +705,15 @@ impl ast::RangePat {
}
impl ast::TokenTree {
pub fn token_trees_and_tokens(
&self,
) -> impl Iterator<Item = NodeOrToken<ast::TokenTree, SyntaxToken>> {
self.syntax().children_with_tokens().filter_map(|not| match not {
NodeOrToken::Node(node) => ast::TokenTree::cast(node).map(NodeOrToken::Node),
NodeOrToken::Token(t) => Some(NodeOrToken::Token(t)),
})
}
pub fn left_delimiter_token(&self) -> Option<SyntaxToken> {
self.syntax()
.first_child_or_token()?