diff --git a/crates/ra_hir/src/name.rs b/crates/ra_hir/src/name.rs index 0bb7cae995..06a2dbc760 100644 --- a/crates/ra_hir/src/name.rs +++ b/crates/ra_hir/src/name.rs @@ -98,14 +98,14 @@ pub(crate) trait AsName { impl AsName for ast::NameRef { fn as_name(&self) -> Name { - let name = resolve_name(self.text().clone()); + let name = resolve_name(self.text()); Name::new(name) } } impl AsName for ast::Name { fn as_name(&self) -> Name { - let name = resolve_name(self.text().clone()); + let name = resolve_name(self.text()); Name::new(name) } } @@ -187,11 +187,11 @@ impl AsName for KnownName { } } -fn resolve_name(text: SmolStr) -> SmolStr { +fn resolve_name(text: &SmolStr) -> SmolStr { let raw_start = "r#"; if text.as_str().starts_with(raw_start) { SmolStr::new(&text[raw_start.len()..]) } else { - text + text.clone() } } diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 78332ce7c4..07b533e290 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs @@ -340,7 +340,7 @@ fn module_resolution_works_for_non_standard_filenames() { #[test] fn module_resolution_works_for_raw_modules() { - let map = def_map_with_crate_graph( + let map = def_map_with_crate_graph( " //- /library.rs mod r#async; @@ -362,7 +362,6 @@ fn module_resolution_works_for_raw_modules() { ⋮crate::async ⋮Bar: t v "###); - } #[test]