mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Fix preorder_expr
skipping the else
block of let-else statements
Fixes exit/yield points not getting highlighted in such blocks for `highlight_related` (#14813; and possibly other bugs in features that use `preorder_expr`).
This commit is contained in:
parent
54129fa113
commit
5857836047
2 changed files with 47 additions and 1 deletions
|
@ -52,7 +52,10 @@ 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) {
|
||||
if Some(node.clone()) != let_stmt.initializer().map(|it| it.syntax().clone()) {
|
||||
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())
|
||||
{
|
||||
// skipping potential const pat expressions in let statements
|
||||
preorder.skip_subtree();
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue