Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/nameres/mod_resolution.rs')
-rw-r--r--crates/hir-def/src/nameres/mod_resolution.rs19
1 files changed, 5 insertions, 14 deletions
diff --git a/crates/hir-def/src/nameres/mod_resolution.rs b/crates/hir-def/src/nameres/mod_resolution.rs
index ab4ffbb2c1..d7e4ca41cd 100644
--- a/crates/hir-def/src/nameres/mod_resolution.rs
+++ b/crates/hir-def/src/nameres/mod_resolution.rs
@@ -4,7 +4,6 @@ use base_db::AnchoredPath;
use hir_expand::{name::Name, HirFileIdExt};
use limit::Limit;
use span::EditionedFileId;
-use syntax::ToSmolStr as _;
use crate::{db::DefDatabase, HirFileId};
@@ -35,7 +34,7 @@ impl ModDir {
let path = match attr_path {
None => {
let mut path = self.dir_path.clone();
- path.push(&name.unescaped().display_no_db().to_smolstr());
+ path.push(name.as_str());
path
}
Some(attr_path) => {
@@ -66,7 +65,7 @@ impl ModDir {
name: &Name,
attr_path: Option<&str>,
) -> Result<(EditionedFileId, bool, ModDir), Box<[String]>> {
- let name = name.unescaped();
+ let name = name.as_str();
let mut candidate_files = ArrayVec::<_, 2>::new();
match attr_path {
@@ -74,16 +73,8 @@ impl ModDir {
candidate_files.push(self.dir_path.join_attr(attr_path, self.root_non_dir_owner))
}
None => {
- candidate_files.push(format!(
- "{}{}.rs",
- self.dir_path.0,
- name.display(db.upcast())
- ));
- candidate_files.push(format!(
- "{}{}/mod.rs",
- self.dir_path.0,
- name.display(db.upcast())
- ));
+ candidate_files.push(format!("{}{}.rs", self.dir_path.0, name));
+ candidate_files.push(format!("{}{}/mod.rs", self.dir_path.0, name));
}
};
@@ -97,7 +88,7 @@ impl ModDir {
let dir_path = if root_dir_owner {
DirPath::empty()
} else {
- DirPath::new(format!("{}/", name.display(db.upcast())))
+ DirPath::new(format!("{}/", name))
};
if let Some(mod_dir) = self.child(dir_path, !root_dir_owner) {
return Ok((