aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src/handlers/generate_enum_projection_method.rs
diff options
context:
space:
mode:
authorcynecx <[email protected]>2021-03-26 17:30:59 +0000
committercynecx <[email protected]>2021-03-26 17:30:59 +0000
commit5ff3299dd61ea5c5790c01819994c9d8fa6afc09 (patch)
treee691982730fe01802f874066927b2ebbe8badc75 /crates/ide_assists/src/handlers/generate_enum_projection_method.rs
parent4ecaad98e074c42dbf637a11afcb630aafffd7b3 (diff)
syntax: return owned string instead of leaking string
Diffstat (limited to 'crates/ide_assists/src/handlers/generate_enum_projection_method.rs')
-rw-r--r--crates/ide_assists/src/handlers/generate_enum_projection_method.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/crates/ide_assists/src/handlers/generate_enum_projection_method.rs b/crates/ide_assists/src/handlers/generate_enum_projection_method.rs
index 871bcab50..e2f572ba3 100644
--- a/crates/ide_assists/src/handlers/generate_enum_projection_method.rs
+++ b/crates/ide_assists/src/handlers/generate_enum_projection_method.rs
@@ -132,7 +132,8 @@ fn generate_enum_projection_method(
132 ast::StructKind::Unit => return None, 132 ast::StructKind::Unit => return None,
133 }; 133 };
134 134
135 let fn_name = format!("{}_{}", props.fn_name_prefix, &to_lower_snake_case(variant_name.text())); 135 let fn_name =
136 format!("{}_{}", props.fn_name_prefix, &to_lower_snake_case(&variant_name.text()));
136 137
137 // Return early if we've found an existing new fn 138 // Return early if we've found an existing new fn
138 let impl_def = find_struct_impl(&ctx, &parent_enum, &fn_name)?; 139 let impl_def = find_struct_impl(&ctx, &parent_enum, &fn_name)?;