aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-08 17:55:17 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-08 17:55:17 +0000
commit51f669606cfbd29f3e9a3695810ead4124f49e84 (patch)
tree1f23b16e096c0eec8daacc31443905c987bbf979 /crates/ra_hir
parent5ad7547ce2f469905992acff5f95e55d54eda714 (diff)
parent7a79cde107ec71abbc7c715e933f29f7a1fb2b95 (diff)
Merge #263
263: New modules r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/function.rs (renamed from crates/ra_hir/src/function/mod.rs)0
-rw-r--r--crates/ra_hir/src/module.rs (renamed from crates/ra_hir/src/module/mod.rs)0
-rw-r--r--crates/ra_hir/src/module/imp.rs40
3 files changed, 20 insertions, 20 deletions
diff --git a/crates/ra_hir/src/function/mod.rs b/crates/ra_hir/src/function.rs
index 5187dc051..5187dc051 100644
--- a/crates/ra_hir/src/function/mod.rs
+++ b/crates/ra_hir/src/function.rs
diff --git a/crates/ra_hir/src/module/mod.rs b/crates/ra_hir/src/module.rs
index 580c737c3..580c737c3 100644
--- a/crates/ra_hir/src/module/mod.rs
+++ b/crates/ra_hir/src/module.rs
diff --git a/crates/ra_hir/src/module/imp.rs b/crates/ra_hir/src/module/imp.rs
index 0eec38797..9f144e139 100644
--- a/crates/ra_hir/src/module/imp.rs
+++ b/crates/ra_hir/src/module/imp.rs
@@ -164,26 +164,26 @@ fn resolve_submodule(
164 164
165 let file_mod = RelativePathBuf::from(format!("../{}.rs", name)); 165 let file_mod = RelativePathBuf::from(format!("../{}.rs", name));
166 let dir_mod = RelativePathBuf::from(format!("../{}/mod.rs", name)); 166 let dir_mod = RelativePathBuf::from(format!("../{}/mod.rs", name));
167 let points_to: Vec<FileId>; 167 let file_dir_mod = RelativePathBuf::from(format!("../{}/{}.rs", mod_name, name));
168 let problem: Option<Problem>; 168 let tmp1;
169 if is_dir_owner { 169 let tmp2;
170 points_to = [&file_mod, &dir_mod] 170 let candidates = if is_dir_owner {
171 .iter() 171 tmp1 = [&file_mod, &dir_mod];
172 .filter_map(|path| file_resolver.resolve(file_id, path)) 172 tmp1.iter()
173 .collect();
174 problem = if points_to.is_empty() {
175 Some(Problem::UnresolvedModule {
176 candidate: file_mod,
177 })
178 } else {
179 None
180 }
181 } else { 173 } else {
182 points_to = Vec::new(); 174 tmp2 = [&file_dir_mod];
183 problem = Some(Problem::NotDirOwner { 175 tmp2.iter()
184 move_to: RelativePathBuf::from(format!("../{}/mod.rs", mod_name)), 176 };
185 candidate: file_mod, 177
186 }); 178 let points_to = candidates
187 } 179 .filter_map(|path| file_resolver.resolve(file_id, path))
180 .collect::<Vec<_>>();
181 let problem = if points_to.is_empty() {
182 Some(Problem::UnresolvedModule {
183 candidate: if is_dir_owner { file_mod } else { file_dir_mod },
184 })
185 } else {
186 None
187 };
188 (points_to, problem) 188 (points_to, problem)
189} 189}