Unnamed repository; edit this file 'description' to name the repository.
Remove redundant fallback state in include_references
A4-Tacks 8 weeks ago
parent d56b49d · commit 642e9e1
-rw-r--r--crates/ide-completion/src/completions/postfix.rs11
1 files changed, 0 insertions, 11 deletions
diff --git a/crates/ide-completion/src/completions/postfix.rs b/crates/ide-completion/src/completions/postfix.rs
index 5b91e7c456..beacc05c3c 100644
--- a/crates/ide-completion/src/completions/postfix.rs
+++ b/crates/ide-completion/src/completions/postfix.rs
@@ -410,13 +410,10 @@ fn include_references(initial_element: &ast::Expr) -> (ast::Expr, String) {
let mut resulting_element = initial_element.clone();
let mut prefix = String::new();
- let mut found_ref_or_deref = false;
-
while let Some(parent_deref_element) =
resulting_element.syntax().parent().and_then(ast::PrefixExpr::cast)
&& parent_deref_element.op_kind() == Some(ast::UnaryOp::Deref)
{
- found_ref_or_deref = true;
resulting_element = ast::Expr::from(parent_deref_element);
prefix.insert(0, '*');
@@ -425,7 +422,6 @@ fn include_references(initial_element: &ast::Expr) -> (ast::Expr, String) {
while let Some(parent_ref_element) =
resulting_element.syntax().parent().and_then(ast::RefExpr::cast)
{
- found_ref_or_deref = true;
let last_child_or_token = parent_ref_element.syntax().last_child_or_token();
prefix.insert_str(
0,
@@ -440,13 +436,6 @@ fn include_references(initial_element: &ast::Expr) -> (ast::Expr, String) {
resulting_element = ast::Expr::from(parent_ref_element);
}
- if !found_ref_or_deref {
- // If we do not find any ref/deref expressions, restore
- // all the progress of tree climbing
- prefix.clear();
- resulting_element = initial_element.clone();
- }
-
(resulting_element, prefix)
}