]> git.lizzy.rs Git - rust.git/commitdiff
Cleanup
authorJonas Goronczy <goronczy.jonas@gmail.com>
Mon, 21 Feb 2022 18:51:09 +0000 (19:51 +0100)
committerJonas Goronczy <goronczy.jonas@gmail.com>
Mon, 21 Feb 2022 18:51:09 +0000 (19:51 +0100)
crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs

index aeecac3c74fe1de7f6a04cd55f5df45e7a59a56b..03ceb895fb61672e555fbc03d23d878bb3fdbd62 100644 (file)
@@ -20,6 +20,7 @@
     },
     match_ast,
     ted::{self, Position},
+    SyntaxElement,
     SyntaxKind::*,
     SyntaxNode, T,
 };
@@ -222,12 +223,7 @@ fn tag_generics_in_variant(
     types: &mut [(ast::TypeParam, bool)],
     consts: &mut [(ast::ConstParam, bool)],
 ) {
-    for token in
-        ty.syntax().preorder_with_tokens().filter_map(|node_or_token| match node_or_token {
-            syntax::WalkEvent::Enter(syntax::NodeOrToken::Token(token)) => Some(token),
-            _ => None,
-        })
-    {
+    for token in ty.syntax().descendants_with_tokens().filter_map(SyntaxElement::into_token) {
         match token.kind() {
             T![lifetime_ident] => {
                 for (lt, present) in lifetimes.iter_mut() {