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/src/inlay_hints.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/src/inlay_hints.rs')
-rw-r--r-- | crates/ide/src/inlay_hints.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs index 16c04eeee..25f96222c 100644 --- a/crates/ide/src/inlay_hints.rs +++ b/crates/ide/src/inlay_hints.rs | |||
@@ -416,7 +416,7 @@ fn get_string_representation(expr: &ast::Expr) -> Option<String> { | |||
416 | match expr { | 416 | match expr { |
417 | ast::Expr::MethodCallExpr(method_call_expr) => { | 417 | ast::Expr::MethodCallExpr(method_call_expr) => { |
418 | let name_ref = method_call_expr.name_ref()?; | 418 | let name_ref = method_call_expr.name_ref()?; |
419 | match name_ref.text() { | 419 | match name_ref.text().as_str() { |
420 | "clone" => method_call_expr.receiver().map(|rec| rec.to_string()), | 420 | "clone" => method_call_expr.receiver().map(|rec| rec.to_string()), |
421 | name_ref => Some(name_ref.to_owned()), | 421 | name_ref => Some(name_ref.to_owned()), |
422 | } | 422 | } |