diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_analysis/src/completion.rs (renamed from crates/ra_analysis/src/completion/mod.rs) | 0 | ||||
-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.rs | 40 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs (renamed from crates/ra_lsp_server/src/main_loop/mod.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/algo.rs (renamed from crates/ra_syntax/src/algo/mod.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast.rs (renamed from crates/ra_syntax/src/ast/mod.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.rs (renamed from crates/ra_syntax/src/grammar/mod.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar/expressions.rs (renamed from crates/ra_syntax/src/grammar/expressions/mod.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar/items.rs (renamed from crates/ra_syntax/src/grammar/items/mod.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/lexer.rs (renamed from crates/ra_syntax/src/lexer/mod.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parser_impl.rs (renamed from crates/ra_syntax/src/parser_impl/mod.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/string_lexing.rs (renamed from crates/ra_syntax/src/string_lexing/mod.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/syntax_kinds.rs (renamed from crates/ra_syntax/src/syntax_kinds/mod.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/validation.rs (renamed from crates/ra_syntax/src/validation/mod.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/yellow.rs (renamed from crates/ra_syntax/src/yellow/mod.rs) | 0 | ||||
-rw-r--r-- | crates/tools/src/main.rs | 10 |
17 files changed, 28 insertions, 22 deletions
diff --git a/crates/ra_analysis/src/completion/mod.rs b/crates/ra_analysis/src/completion.rs index 0f154112a..0f154112a 100644 --- a/crates/ra_analysis/src/completion/mod.rs +++ b/crates/ra_analysis/src/completion.rs | |||
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 | } |
diff --git a/crates/ra_lsp_server/src/main_loop/mod.rs b/crates/ra_lsp_server/src/main_loop.rs index 0e1878906..0e1878906 100644 --- a/crates/ra_lsp_server/src/main_loop/mod.rs +++ b/crates/ra_lsp_server/src/main_loop.rs | |||
diff --git a/crates/ra_syntax/src/algo/mod.rs b/crates/ra_syntax/src/algo.rs index 4b3548ea9..4b3548ea9 100644 --- a/crates/ra_syntax/src/algo/mod.rs +++ b/crates/ra_syntax/src/algo.rs | |||
diff --git a/crates/ra_syntax/src/ast/mod.rs b/crates/ra_syntax/src/ast.rs index 91c67119f..91c67119f 100644 --- a/crates/ra_syntax/src/ast/mod.rs +++ b/crates/ra_syntax/src/ast.rs | |||
diff --git a/crates/ra_syntax/src/grammar/mod.rs b/crates/ra_syntax/src/grammar.rs index 06a37d648..06a37d648 100644 --- a/crates/ra_syntax/src/grammar/mod.rs +++ b/crates/ra_syntax/src/grammar.rs | |||
diff --git a/crates/ra_syntax/src/grammar/expressions/mod.rs b/crates/ra_syntax/src/grammar/expressions.rs index 60c8602f9..60c8602f9 100644 --- a/crates/ra_syntax/src/grammar/expressions/mod.rs +++ b/crates/ra_syntax/src/grammar/expressions.rs | |||
diff --git a/crates/ra_syntax/src/grammar/items/mod.rs b/crates/ra_syntax/src/grammar/items.rs index 4473c2fab..4473c2fab 100644 --- a/crates/ra_syntax/src/grammar/items/mod.rs +++ b/crates/ra_syntax/src/grammar/items.rs | |||
diff --git a/crates/ra_syntax/src/lexer/mod.rs b/crates/ra_syntax/src/lexer.rs index f388da273..f388da273 100644 --- a/crates/ra_syntax/src/lexer/mod.rs +++ b/crates/ra_syntax/src/lexer.rs | |||
diff --git a/crates/ra_syntax/src/parser_impl/mod.rs b/crates/ra_syntax/src/parser_impl.rs index cb6e370ac..cb6e370ac 100644 --- a/crates/ra_syntax/src/parser_impl/mod.rs +++ b/crates/ra_syntax/src/parser_impl.rs | |||
diff --git a/crates/ra_syntax/src/string_lexing/mod.rs b/crates/ra_syntax/src/string_lexing.rs index 94853331f..94853331f 100644 --- a/crates/ra_syntax/src/string_lexing/mod.rs +++ b/crates/ra_syntax/src/string_lexing.rs | |||
diff --git a/crates/ra_syntax/src/syntax_kinds/mod.rs b/crates/ra_syntax/src/syntax_kinds.rs index d53886676..d53886676 100644 --- a/crates/ra_syntax/src/syntax_kinds/mod.rs +++ b/crates/ra_syntax/src/syntax_kinds.rs | |||
diff --git a/crates/ra_syntax/src/validation/mod.rs b/crates/ra_syntax/src/validation.rs index bdee8120c..bdee8120c 100644 --- a/crates/ra_syntax/src/validation/mod.rs +++ b/crates/ra_syntax/src/validation.rs | |||
diff --git a/crates/ra_syntax/src/yellow/mod.rs b/crates/ra_syntax/src/yellow.rs index cacd89dc8..cacd89dc8 100644 --- a/crates/ra_syntax/src/yellow/mod.rs +++ b/crates/ra_syntax/src/yellow.rs | |||
diff --git a/crates/tools/src/main.rs b/crates/tools/src/main.rs index 7bd4a2d09..d2a6aa94f 100644 --- a/crates/tools/src/main.rs +++ b/crates/tools/src/main.rs | |||
@@ -79,15 +79,21 @@ fn tests_from_dir(dir: &Path) -> Result<HashMap<String, Test>> { | |||
79 | if entry.path().extension().unwrap_or_default() != "rs" { | 79 | if entry.path().extension().unwrap_or_default() != "rs" { |
80 | continue; | 80 | continue; |
81 | } | 81 | } |
82 | let text = fs::read_to_string(entry.path())?; | 82 | process_file(&mut res, entry.path())?; |
83 | } | ||
84 | let grammar_rs = dir.parent().unwrap().join("grammar.rs"); | ||
85 | process_file(&mut res, &grammar_rs)?; | ||
86 | return Ok(res); | ||
87 | fn process_file(res: &mut HashMap<String, Test>, path: &Path) -> Result<()> { | ||
88 | let text = fs::read_to_string(path)?; | ||
83 | 89 | ||
84 | for (_, test) in collect_tests(&text) { | 90 | for (_, test) in collect_tests(&text) { |
85 | if let Some(old_test) = res.insert(test.name.clone(), test) { | 91 | if let Some(old_test) = res.insert(test.name.clone(), test) { |
86 | bail!("Duplicate test: {}", old_test.name) | 92 | bail!("Duplicate test: {}", old_test.name) |
87 | } | 93 | } |
88 | } | 94 | } |
95 | Ok(()) | ||
89 | } | 96 | } |
90 | Ok(res) | ||
91 | } | 97 | } |
92 | 98 | ||
93 | fn existing_tests(dir: &Path) -> Result<HashMap<String, (PathBuf, Test)>> { | 99 | fn existing_tests(dir: &Path) -> Result<HashMap<String, (PathBuf, Test)>> { |