Unnamed repository; edit this file 'description' to name the repository.
Merge #10786
10786: minor: remove duplicate calls r=Veykril a=XFFXFF `scopes.set_scope(*expr, scope)` is duplicate, because we always call it in `compute_expr_scopes` https://github.com/rust-analyzer/rust-analyzer/blob/add6cccd4c923fbb5c83cc27b06aa84b2cbc9557/crates/hir_def/src/body/scope.rs#L175-L180 Co-authored-by: zhoufan <[email protected]>
bors[bot] 2021-11-17
parent add6ccc · parent 1f1682e · commit e051ae8
-rw-r--r--crates/hir_def/src/body/scope.rs3
1 files changed, 0 insertions, 3 deletions
diff --git a/crates/hir_def/src/body/scope.rs b/crates/hir_def/src/body/scope.rs
index f40eb2f9d4..147d641235 100644
--- a/crates/hir_def/src/body/scope.rs
+++ b/crates/hir_def/src/body/scope.rs
@@ -151,18 +151,15 @@ fn compute_block_scopes(
match stmt {
Statement::Let { pat, initializer, else_branch, .. } => {
if let Some(expr) = initializer {
- scopes.set_scope(*expr, scope);
compute_expr_scopes(*expr, body, scopes, scope);
}
if let Some(expr) = else_branch {
- scopes.set_scope(*expr, scope);
compute_expr_scopes(*expr, body, scopes, scope);
}
scope = scopes.new_scope(scope);
scopes.add_bindings(body, scope, *pat);
}
Statement::Expr { expr, .. } => {
- scopes.set_scope(*expr, scope);
compute_expr_scopes(*expr, body, scopes, scope);
}
}