diff options
Diffstat (limited to 'crates/ra_hir/src/module')
-rw-r--r-- | crates/ra_hir/src/module/imp.rs | 40 |
1 files changed, 20 insertions, 20 deletions
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 | } |