Update crates/ide-db/src/syntax_helpers/node_ext.rs

Co-authored-by: Bastiaan Marinus van de Weerd <id@bm-w.eu>
This commit is contained in:
Lukas Wirth 2023-05-19 09:33:57 +02:00 committed by GitHub
parent 5857836047
commit c0519daf3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,9 +52,8 @@ pub fn preorder_expr(start: &ast::Expr, cb: &mut dyn FnMut(WalkEvent<ast::Expr>)
}
};
if let Some(let_stmt) = node.parent().and_then(ast::LetStmt::cast) {
let node = Some(node.clone());
if node != let_stmt.initializer().map(|it| it.syntax().clone())
&& node != let_stmt.let_else().map(|it| it.syntax().clone())
if let_stmt.initializer().map(|it| it.syntax() != &node).unwrap_or(true)
&& let_stmt.let_else().map(|it| it.syntax() != &node).unwrap_or(true)
{
// skipping potential const pat expressions in let statements
preorder.skip_subtree();