diff options
author | Aleksey Kladov <[email protected]> | 2019-01-08 12:57:45 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-08 13:35:36 +0000 |
commit | 544c63b58e3d571257239fd87036f1b6818e3b14 (patch) | |
tree | 85e7fdd60f3a8ba2f62b960c5f2e9ce83c738c6b /crates/ra_hir/src/nameres | |
parent | 5603237c069c600963b8e25481af397b25e3b185 (diff) |
dont reexport module id
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r-- | crates/ra_hir/src/nameres/tests.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 04faec4fb..82222d1ad 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs | |||
@@ -6,22 +6,23 @@ use relative_path::RelativePath; | |||
6 | use test_utils::assert_eq_text; | 6 | use test_utils::assert_eq_text; |
7 | 7 | ||
8 | use crate::{ | 8 | use crate::{ |
9 | self as hir, | 9 | ItemMap, Resolution, |
10 | db::HirDatabase, | 10 | db::HirDatabase, |
11 | mock::MockDatabase, | 11 | mock::MockDatabase, |
12 | module_tree::ModuleId, | ||
12 | }; | 13 | }; |
13 | 14 | ||
14 | fn item_map(fixture: &str) -> (Arc<hir::ItemMap>, hir::ModuleId) { | 15 | fn item_map(fixture: &str) -> (Arc<ItemMap>, ModuleId) { |
15 | let (db, pos) = MockDatabase::with_position(fixture); | 16 | let (db, pos) = MockDatabase::with_position(fixture); |
16 | let source_root = db.file_source_root(pos.file_id); | 17 | let source_root = db.file_source_root(pos.file_id); |
17 | let module = hir::source_binder::module_from_position(&db, pos) | 18 | let module = crate::source_binder::module_from_position(&db, pos) |
18 | .unwrap() | 19 | .unwrap() |
19 | .unwrap(); | 20 | .unwrap(); |
20 | let module_id = module.def_id.loc(&db).module_id; | 21 | let module_id = module.def_id.loc(&db).module_id; |
21 | (db.item_map(source_root).unwrap(), module_id) | 22 | (db.item_map(source_root).unwrap(), module_id) |
22 | } | 23 | } |
23 | 24 | ||
24 | fn check_module_item_map(map: &hir::ItemMap, module_id: hir::ModuleId, expected: &str) { | 25 | fn check_module_item_map(map: &ItemMap, module_id: ModuleId, expected: &str) { |
25 | let mut lines = map.per_module[&module_id] | 26 | let mut lines = map.per_module[&module_id] |
26 | .items | 27 | .items |
27 | .iter() | 28 | .iter() |
@@ -37,7 +38,7 @@ fn check_module_item_map(map: &hir::ItemMap, module_id: hir::ModuleId, expected: | |||
37 | .join("\n"); | 38 | .join("\n"); |
38 | assert_eq_text!(&expected, &actual); | 39 | assert_eq_text!(&expected, &actual); |
39 | 40 | ||
40 | fn dump_resolution(resolution: &hir::Resolution) -> &'static str { | 41 | fn dump_resolution(resolution: &Resolution) -> &'static str { |
41 | match ( | 42 | match ( |
42 | resolution.def_id.types.is_some(), | 43 | resolution.def_id.types.is_some(), |
43 | resolution.def_id.values.is_some(), | 44 | resolution.def_id.values.is_some(), |
@@ -181,7 +182,7 @@ fn item_map_across_crates() { | |||
181 | db.set_crate_graph(crate_graph); | 182 | db.set_crate_graph(crate_graph); |
182 | 183 | ||
183 | let source_root = db.file_source_root(main_id); | 184 | let source_root = db.file_source_root(main_id); |
184 | let module = hir::source_binder::module_from_file_id(&db, main_id) | 185 | let module = crate::source_binder::module_from_file_id(&db, main_id) |
185 | .unwrap() | 186 | .unwrap() |
186 | .unwrap(); | 187 | .unwrap(); |
187 | let module_id = module.def_id.loc(&db).module_id; | 188 | let module_id = module.def_id.loc(&db).module_id; |