aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/name.rs8
-rw-r--r--crates/ra_hir/src/nameres/tests.rs3
2 files changed, 5 insertions, 6 deletions
diff --git a/crates/ra_hir/src/name.rs b/crates/ra_hir/src/name.rs
index 0bb7cae99..06a2dbc76 100644
--- a/crates/ra_hir/src/name.rs
+++ b/crates/ra_hir/src/name.rs
@@ -98,14 +98,14 @@ pub(crate) trait AsName {
98 98
99impl AsName for ast::NameRef { 99impl AsName for ast::NameRef {
100 fn as_name(&self) -> Name { 100 fn as_name(&self) -> Name {
101 let name = resolve_name(self.text().clone()); 101 let name = resolve_name(self.text());
102 Name::new(name) 102 Name::new(name)
103 } 103 }
104} 104}
105 105
106impl AsName for ast::Name { 106impl AsName for ast::Name {
107 fn as_name(&self) -> Name { 107 fn as_name(&self) -> Name {
108 let name = resolve_name(self.text().clone()); 108 let name = resolve_name(self.text());
109 Name::new(name) 109 Name::new(name)
110 } 110 }
111} 111}
@@ -187,11 +187,11 @@ impl AsName for KnownName {
187 } 187 }
188} 188}
189 189
190fn resolve_name(text: SmolStr) -> SmolStr { 190fn resolve_name(text: &SmolStr) -> SmolStr {
191 let raw_start = "r#"; 191 let raw_start = "r#";
192 if text.as_str().starts_with(raw_start) { 192 if text.as_str().starts_with(raw_start) {
193 SmolStr::new(&text[raw_start.len()..]) 193 SmolStr::new(&text[raw_start.len()..])
194 } else { 194 } else {
195 text 195 text.clone()
196 } 196 }
197} 197}
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs
index 78332ce7c..07b533e29 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() {
340 340
341#[test] 341#[test]
342fn module_resolution_works_for_raw_modules() { 342fn module_resolution_works_for_raw_modules() {
343 let map = def_map_with_crate_graph( 343 let map = def_map_with_crate_graph(
344 " 344 "
345 //- /library.rs 345 //- /library.rs
346 mod r#async; 346 mod r#async;
@@ -362,7 +362,6 @@ fn module_resolution_works_for_raw_modules() {
362 ⋮crate::async 362 ⋮crate::async
363 ⋮Bar: t v 363 ⋮Bar: t v
364 "###); 364 "###);
365
366} 365}
367 366
368#[test] 367#[test]