aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres/tests.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-06-10 23:26:50 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-06-10 23:26:50 +0100
commit1c867b4e67126350579d6d598efeb6c03b503ddc (patch)
tree5e0d18e023a095c64a02f1c44c4a82245c89beeb /crates/ra_hir/src/nameres/tests.rs
parent75e6c03883c4533b1134c806d166b72200b4837d (diff)
parent156b7ee84210583fa2fdc7fb8ae1dccafdf80830 (diff)
Merge #1390
1390: use single version of either in hir r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/nameres/tests.rs')
-rw-r--r--crates/ra_hir/src/nameres/tests.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs
index a15e62bbe..adac814d9 100644
--- a/crates/ra_hir/src/nameres/tests.rs
+++ b/crates/ra_hir/src/nameres/tests.rs
@@ -8,10 +8,9 @@ use std::sync::Arc;
8use ra_db::SourceDatabase; 8use ra_db::SourceDatabase;
9use test_utils::covers; 9use test_utils::covers;
10use insta::assert_snapshot_matches; 10use insta::assert_snapshot_matches;
11use either::Either;
12 11
13use crate::{ 12use crate::{
14 Crate, 13 Crate, Either,
15 mock::{MockDatabase, CrateGraphFixture}, 14 mock::{MockDatabase, CrateGraphFixture},
16 nameres::Resolution, 15 nameres::Resolution,
17}; 16};
@@ -37,19 +36,17 @@ fn render_crate_def_map(map: &CrateDefMap) -> String {
37 *buf += path; 36 *buf += path;
38 *buf += "\n"; 37 *buf += "\n";
39 38
40 let items = 39 let items = map.modules[module].scope.items.iter().map(|(name, it)| (name, Either::A(it)));
41 map.modules[module].scope.items.iter().map(|(name, it)| (name, Either::Left(it))); 40 let macros = map.modules[module].scope.macros.iter().map(|(name, m)| (name, Either::B(m)));
42 let macros =
43 map.modules[module].scope.macros.iter().map(|(name, m)| (name, Either::Right(m)));
44 let mut entries = items.chain(macros).collect::<Vec<_>>(); 41 let mut entries = items.chain(macros).collect::<Vec<_>>();
45 42
46 entries.sort_by_key(|(name, _)| *name); 43 entries.sort_by_key(|(name, _)| *name);
47 for (name, res) in entries { 44 for (name, res) in entries {
48 match res { 45 match res {
49 Either::Left(it) => { 46 Either::A(it) => {
50 *buf += &format!("{}: {}\n", name, dump_resolution(it)); 47 *buf += &format!("{}: {}\n", name, dump_resolution(it));
51 } 48 }
52 Either::Right(_) => { 49 Either::B(_) => {
53 *buf += &format!("{}: m\n", name); 50 *buf += &format!("{}: m\n", name);
54 } 51 }
55 } 52 }