diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-26 17:59:06 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-26 17:59:06 +0000 |
commit | 77a447dcda82a9f0eb6e1f04bd4b1dd53a226c65 (patch) | |
tree | e691982730fe01802f874066927b2ebbe8badc75 /crates/ide_assists/src/handlers/generate_enum_is_method.rs | |
parent | 4ecaad98e074c42dbf637a11afcb630aafffd7b3 (diff) | |
parent | 5ff3299dd61ea5c5790c01819994c9d8fa6afc09 (diff) |
Merge #8191
8191: syntax: return owned string instead of leaking string r=cynecx a=cynecx
Quick hack? to alleviate https://github.com/rust-analyzer/rust-analyzer/issues/8181#issuecomment-806019126. I haven't run any tests but this should affect performance since we are deallocating more.
r? @matklad
Co-authored-by: cynecx <[email protected]>
Diffstat (limited to 'crates/ide_assists/src/handlers/generate_enum_is_method.rs')
-rw-r--r-- | crates/ide_assists/src/handlers/generate_enum_is_method.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/ide_assists/src/handlers/generate_enum_is_method.rs b/crates/ide_assists/src/handlers/generate_enum_is_method.rs index 7e181a480..a9f71a703 100644 --- a/crates/ide_assists/src/handlers/generate_enum_is_method.rs +++ b/crates/ide_assists/src/handlers/generate_enum_is_method.rs | |||
@@ -44,7 +44,7 @@ pub(crate) fn generate_enum_is_method(acc: &mut Assists, ctx: &AssistContext) -> | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | let enum_lowercase_name = to_lower_snake_case(&parent_enum.name()?.to_string()); | 46 | let enum_lowercase_name = to_lower_snake_case(&parent_enum.name()?.to_string()); |
47 | let fn_name = format!("is_{}", &to_lower_snake_case(variant_name.text())); | 47 | let fn_name = format!("is_{}", &to_lower_snake_case(&variant_name.text())); |
48 | 48 | ||
49 | // Return early if we've found an existing new fn | 49 | // Return early if we've found an existing new fn |
50 | let impl_def = find_struct_impl(&ctx, &parent_enum, &fn_name)?; | 50 | let impl_def = find_struct_impl(&ctx, &parent_enum, &fn_name)?; |