diff options
Diffstat (limited to 'crates/ra_hir/src/nameres/tests.rs')
-rw-r--r-- | crates/ra_hir/src/nameres/tests.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 14c8ee50b..ffb627c02 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs | |||
@@ -7,6 +7,7 @@ use std::sync::Arc; | |||
7 | use ra_db::SourceDatabase; | 7 | use ra_db::SourceDatabase; |
8 | use test_utils::covers; | 8 | use test_utils::covers; |
9 | use insta::assert_snapshot_matches; | 9 | use insta::assert_snapshot_matches; |
10 | use either::Either; | ||
10 | 11 | ||
11 | use crate::{ | 12 | use crate::{ |
12 | Crate, | 13 | Crate, |
@@ -35,10 +36,22 @@ fn render_crate_def_map(map: &CrateDefMap) -> String { | |||
35 | *buf += path; | 36 | *buf += path; |
36 | *buf += "\n"; | 37 | *buf += "\n"; |
37 | 38 | ||
38 | let mut entries = map.modules[module].scope.items.iter().collect::<Vec<_>>(); | 39 | let items = |
40 | map.modules[module].scope.items.iter().map(|(name, it)| (name, Either::Left(it))); | ||
41 | let macros = | ||
42 | map.modules[module].scope.macros.iter().map(|(name, m)| (name, Either::Right(m))); | ||
43 | let mut entries = items.chain(macros).collect::<Vec<_>>(); | ||
44 | |||
39 | entries.sort_by_key(|(name, _)| *name); | 45 | entries.sort_by_key(|(name, _)| *name); |
40 | for (name, res) in entries { | 46 | for (name, res) in entries { |
41 | *buf += &format!("{}: {}\n", name, dump_resolution(res)) | 47 | match res { |
48 | Either::Left(it) => { | ||
49 | *buf += &format!("{}: {}\n", name, dump_resolution(it)); | ||
50 | } | ||
51 | Either::Right(_) => { | ||
52 | *buf += &format!("{}: m\n", name); | ||
53 | } | ||
54 | } | ||
42 | } | 55 | } |
43 | for (name, child) in map.modules[module].children.iter() { | 56 | for (name, child) in map.modules[module].children.iter() { |
44 | let path = path.to_string() + &format!("::{}", name); | 57 | let path = path.to_string() + &format!("::{}", name); |