diff options
| author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2020-12-22 19:18:45 +0300 |
|---|---|---|
| committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2020-12-23 11:02:42 +0300 |
| commit | 2c84c2d07af013006b8092c7303aa8c73f677fea (patch) | |
| tree | c90d4fd9f9520044e870355b6fb791c9e95354a3 | |
| parent | 58b6763f206b80a3000eb3c7642181fa5fb98229 (diff) | |
| download | rust-2c84c2d07af013006b8092c7303aa8c73f677fea.tar.gz rust-2c84c2d07af013006b8092c7303aa8c73f677fea.zip | |
Don't think that /submod.rs is /mod.rs
| -rw-r--r-- | crates/assists/src/handlers/extract_module_to_file.rs | 8 | ||||
| -rw-r--r-- | crates/hir_def/src/nameres/mod_resolution.rs | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/crates/assists/src/handlers/extract_module_to_file.rs b/crates/assists/src/handlers/extract_module_to_file.rs index 3e67fdca2f1..50bf67ef77b 100644 --- a/crates/assists/src/handlers/extract_module_to_file.rs +++ b/crates/assists/src/handlers/extract_module_to_file.rs @@ -91,18 +91,18 @@ mod tests; extract_module_to_file, r#" //- /main.rs -mod submodule; -//- /submodule.rs +mod submod; +//- /submod.rs mod inner<|> { fn f() {} } fn g() {} "#, r#" -//- /submodule.rs +//- /submod.rs mod inner; fn g() {} -//- /submodule/inner.rs +//- /submod/inner.rs fn f() {} "#, ); diff --git a/crates/hir_def/src/nameres/mod_resolution.rs b/crates/hir_def/src/nameres/mod_resolution.rs index b4ccd4488b4..af326243965 100644 --- a/crates/hir_def/src/nameres/mod_resolution.rs +++ b/crates/hir_def/src/nameres/mod_resolution.rs @@ -79,7 +79,7 @@ impl ModDir { for candidate in candidate_files.iter() { let path = AnchoredPath { anchor: file_id, path: candidate.as_str() }; if let Some(file_id) = db.resolve_path(path) { - let is_mod_rs = candidate.ends_with("mod.rs"); + let is_mod_rs = candidate.ends_with("/mod.rs"); let (dir_path, root_non_dir_owner) = if is_mod_rs || attr_path.is_some() { (DirPath::empty(), false) |
