From 2137bdfca3adfb2cffb552eeec3f366c5950d223 Mon Sep 17 00:00:00 2001 From: cameron Date: Mon, 4 Apr 2022 14:28:15 +0100 Subject: [PATCH] remove unwarp on adt name --- crates/ide_completion/src/render/function.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/ide_completion/src/render/function.rs b/crates/ide_completion/src/render/function.rs index 82688cfae6..6032b28fc6 100644 --- a/crates/ide_completion/src/render/function.rs +++ b/crates/ide_completion/src/render/function.rs @@ -137,10 +137,12 @@ pub(super) fn add_call_parens<'b>( } None => { let name = match param.ty().as_adt() { - Some(adt) => { - to_lower_snake_case(&adt.name(ctx.db).as_text().unwrap()) - } None => "_".to_string(), + Some(adt) => adt + .name(ctx.db) + .as_text() + .map(to_lower_snake_case) + .unwrap_or("_".to_string()), }; f(&format_args!("${{{}:{}}}", index + offset, name)) }