Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/destructure_tuple_binding.rs')
-rw-r--r--crates/ide-assists/src/handlers/destructure_tuple_binding.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/crates/ide-assists/src/handlers/destructure_tuple_binding.rs b/crates/ide-assists/src/handlers/destructure_tuple_binding.rs
index b9142d0318..7df6ca1565 100644
--- a/crates/ide-assists/src/handlers/destructure_tuple_binding.rs
+++ b/crates/ide-assists/src/handlers/destructure_tuple_binding.rs
@@ -6,7 +6,6 @@ use ide_db::{
text_edit::TextRange,
};
use itertools::Itertools;
-use syntax::SmolStr;
use syntax::{
ast::{self, make, AstNode, FieldExpr, HasName, IdentPat},
ted,
@@ -134,17 +133,8 @@ fn collect_data(ident_pat: IdentPat, ctx: &AssistContext<'_>) -> Option<TupleDat
.map(|(_, refs)| refs.to_vec())
});
- let mut name_generator = {
- let mut names = vec![];
- if let Some(scope) = ctx.sema.scope(ident_pat.syntax()) {
- scope.process_all_names(&mut |name, scope| {
- if let hir::ScopeDef::Local(_) = scope {
- names.push(name.as_str().into())
- }
- })
- }
- suggest_name::NameGenerator::new_with_names(names.iter().map(|s: &SmolStr| s.as_str()))
- };
+ let mut name_generator =
+ suggest_name::NameGenerator::new_from_scope_locals(ctx.sema.scope(ident_pat.syntax()));
let field_names = field_types
.into_iter()