We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc1a577 commit 919ecc6Copy full SHA for 919ecc6
crates/ide-assists/src/utils/suggest_name.rs
@@ -1,5 +1,7 @@
1
//! This module contains functions to suggest names for expressions, functions and other items
2
3
+use std::collections::HashSet;
4
+
5
use hir::Semantics;
6
use ide_db::RootDatabase;
7
use itertools::Itertools;
@@ -76,12 +78,9 @@ pub(crate) fn for_unique_generic_name(
76
78
ast::GenericParam::TypeParam(t) => t.name().unwrap().to_string(),
77
79
p => p.to_string(),
80
})
- .collect_vec();
81
+ .collect::<HashSet<_>>();
82
let mut name = name.to_string();
83
let base_len = name.len();
- // 4*len bytes for base, and 2 bytes for 2 digits
- name.reserve(4 * base_len + 2);
84
-
85
let mut count = 0;
86
while param_names.contains(&name) {
87
name.truncate(base_len);
0 commit comments