From 5ff3299dd61ea5c5790c01819994c9d8fa6afc09 Mon Sep 17 00:00:00 2001 From: cynecx Date: Fri, 26 Mar 2021 18:30:59 +0100 Subject: syntax: return owned string instead of leaking string --- crates/ide_db/src/defs.rs | 2 +- crates/ide_db/src/helpers/import_assets.rs | 2 +- crates/ide_db/src/helpers/insert_use.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ide_db/src') 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 { hir::AssocItem::TypeAlias(it) => Some(*it), _ => None, }) - .find(|alias| &alias.name(sema.db).to_string() == name_ref.text()) + .find(|alias| &alias.name(sema.db).to_string() == &name_ref.text()) { return Some(NameRefClass::Definition(Definition::ModuleDef( 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( import_for_item( sema.db, mod_path, - unresolved_first_segment, + &unresolved_first_segment, &unresolved_qualifier, item, ) 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 { PathSegmentKind::SelfKw => ImportGroup::ThisModule, PathSegmentKind::SuperKw => ImportGroup::SuperModule, PathSegmentKind::CrateKw => ImportGroup::ThisCrate, - PathSegmentKind::Name(name) => match name.text() { + PathSegmentKind::Name(name) => match name.text().as_str() { "std" => ImportGroup::Std, "core" => ImportGroup::Std, _ => ImportGroup::ExternCrate, -- cgit v1.2.3