Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-db/src/syntax_helpers/suggest_name.rs')
-rw-r--r--crates/ide-db/src/syntax_helpers/suggest_name.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ide-db/src/syntax_helpers/suggest_name.rs b/crates/ide-db/src/syntax_helpers/suggest_name.rs
index 09e6115320..76fea5c262 100644
--- a/crates/ide-db/src/syntax_helpers/suggest_name.rs
+++ b/crates/ide-db/src/syntax_helpers/suggest_name.rs
@@ -193,7 +193,10 @@ impl NameGenerator {
pub fn for_impl_trait_as_generic(&mut self, ty: &ast::ImplTraitType) -> SmolStr {
let c = ty
.type_bound_list()
- .and_then(|bounds| bounds.syntax().text().char_at(0.into()))
+ .and_then(|bounds| {
+ let ty = bounds.bounds().next()?.ty()?;
+ ty.syntax().text().char_at(0.into()).filter(|ch| ch.is_alphabetic())
+ })
.unwrap_or('T');
self.suggest_name(&c.to_string())