Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide_db/src/helpers/insert_use.rs')
| -rw-r--r-- | crates/ide_db/src/helpers/insert_use.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ide_db/src/helpers/insert_use.rs b/crates/ide_db/src/helpers/insert_use.rs index 1f3e3c55bf..d6f8cd0f4b 100644 --- a/crates/ide_db/src/helpers/insert_use.rs +++ b/crates/ide_db/src/helpers/insert_use.rs @@ -401,7 +401,7 @@ fn insert_use_( .children_with_tokens() .filter(|child| match child { NodeOrToken::Node(node) => is_inner_attribute(node.clone()), - NodeOrToken::Token(token) => is_inner_comment(token.clone()), + NodeOrToken::Token(token) => is_comment(token.clone()), }) .last() { @@ -440,7 +440,6 @@ fn is_inner_attribute(node: SyntaxNode) -> bool { ast::Attr::cast(node).map(|attr| attr.kind()) == Some(ast::AttrKind::Inner) } -fn is_inner_comment(token: SyntaxToken) -> bool { - ast::Comment::cast(token).and_then(|comment| comment.kind().doc) - == Some(ast::CommentPlacement::Inner) +fn is_comment(token: SyntaxToken) -> bool { + ast::Comment::cast(token).is_some() } |