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_db/src | |
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_db/src')
-rw-r--r-- | crates/ide_db/src/defs.rs | 2 | ||||
-rw-r--r-- | crates/ide_db/src/helpers/import_assets.rs | 2 | ||||
-rw-r--r-- | crates/ide_db/src/helpers/insert_use.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs index 75167ff39..ab23dd7ac 100644 --- a/crates/ide_db/src/defs.rs +++ b/crates/ide_db/src/defs.rs | |||
@@ -343,7 +343,7 @@ impl NameRefClass { | |||
343 | hir::AssocItem::TypeAlias(it) => Some(*it), | 343 | hir::AssocItem::TypeAlias(it) => Some(*it), |
344 | _ => None, | 344 | _ => None, |
345 | }) | 345 | }) |
346 | .find(|alias| &alias.name(sema.db).to_string() == name_ref.text()) | 346 | .find(|alias| &alias.name(sema.db).to_string() == &name_ref.text()) |
347 | { | 347 | { |
348 | return Some(NameRefClass::Definition(Definition::ModuleDef( | 348 | return Some(NameRefClass::Definition(Definition::ModuleDef( |
349 | ModuleDef::TypeAlias(ty), | 349 | ModuleDef::TypeAlias(ty), |
diff --git a/crates/ide_db/src/helpers/import_assets.rs b/crates/ide_db/src/helpers/import_assets.rs index 1881c746f..3deb0d159 100644 --- a/crates/ide_db/src/helpers/import_assets.rs +++ b/crates/ide_db/src/helpers/import_assets.rs | |||
@@ -288,7 +288,7 @@ fn path_applicable_imports( | |||
288 | import_for_item( | 288 | import_for_item( |
289 | sema.db, | 289 | sema.db, |
290 | mod_path, | 290 | mod_path, |
291 | unresolved_first_segment, | 291 | &unresolved_first_segment, |
292 | &unresolved_qualifier, | 292 | &unresolved_qualifier, |
293 | item, | 293 | item, |
294 | ) | 294 | ) |
diff --git a/crates/ide_db/src/helpers/insert_use.rs b/crates/ide_db/src/helpers/insert_use.rs index 20c195f82..e681ced80 100644 --- a/crates/ide_db/src/helpers/insert_use.rs +++ b/crates/ide_db/src/helpers/insert_use.rs | |||
@@ -509,7 +509,7 @@ impl ImportGroup { | |||
509 | PathSegmentKind::SelfKw => ImportGroup::ThisModule, | 509 | PathSegmentKind::SelfKw => ImportGroup::ThisModule, |
510 | PathSegmentKind::SuperKw => ImportGroup::SuperModule, | 510 | PathSegmentKind::SuperKw => ImportGroup::SuperModule, |
511 | PathSegmentKind::CrateKw => ImportGroup::ThisCrate, | 511 | PathSegmentKind::CrateKw => ImportGroup::ThisCrate, |
512 | PathSegmentKind::Name(name) => match name.text() { | 512 | PathSegmentKind::Name(name) => match name.text().as_str() { |
513 | "std" => ImportGroup::Std, | 513 | "std" => ImportGroup::Std, |
514 | "core" => ImportGroup::Std, | 514 | "core" => ImportGroup::Std, |
515 | _ => ImportGroup::ExternCrate, | 515 | _ => ImportGroup::ExternCrate, |