aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_assists/src/utils')
-rw-r--r--crates/ide_assists/src/utils/suggest_name.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ide_assists/src/utils/suggest_name.rs b/crates/ide_assists/src/utils/suggest_name.rs
index c8487846d..b3aabeab3 100644
--- a/crates/ide_assists/src/utils/suggest_name.rs
+++ b/crates/ide_assists/src/utils/suggest_name.rs
@@ -57,7 +57,7 @@ const USELESS_METHODS: &[&str] = &[
57 "iter_mut", 57 "iter_mut",
58]; 58];
59 59
60pub(crate) fn generic_parameter(ty: &ast::ImplTraitType) -> SmolStr { 60pub(crate) fn for_generic_parameter(ty: &ast::ImplTraitType) -> SmolStr {
61 let c = ty 61 let c = ty
62 .type_bound_list() 62 .type_bound_list()
63 .and_then(|bounds| bounds.syntax().text().char_at(0.into())) 63 .and_then(|bounds| bounds.syntax().text().char_at(0.into()))
@@ -83,7 +83,8 @@ pub(crate) fn generic_parameter(ty: &ast::ImplTraitType) -> SmolStr {
83/// It also applies heuristics to filter out less informative names 83/// It also applies heuristics to filter out less informative names
84/// 84///
85/// Currently it sticks to the first name found. 85/// Currently it sticks to the first name found.
86pub(crate) fn variable(expr: &ast::Expr, sema: &Semantics<'_, RootDatabase>) -> String { 86// FIXME: Microoptimize and return a `SmolStr` here.
87pub(crate) fn for_variable(expr: &ast::Expr, sema: &Semantics<'_, RootDatabase>) -> String {
87 // `from_param` does not benifit from stripping 88 // `from_param` does not benifit from stripping
88 // it need the largest context possible 89 // it need the largest context possible
89 // so we check firstmost 90 // so we check firstmost
@@ -284,7 +285,7 @@ mod tests {
284 frange.range, 285 frange.range,
285 "selection is not an expression(yet contained in one)" 286 "selection is not an expression(yet contained in one)"
286 ); 287 );
287 let name = variable(&expr, &sema); 288 let name = for_variable(&expr, &sema);
288 assert_eq!(&name, expected); 289 assert_eq!(&name, expected);
289 } 290 }
290 291