diff options
author | Aleksey Kladov <[email protected]> | 2019-10-30 15:50:10 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-10-30 15:50:10 +0000 |
commit | b05d6e53fb0e9a008dc2e1220b1201818e63ed2d (patch) | |
tree | b3207114d918b50b17adc1db589454fed266eed7 /crates/ra_hir_def/src/nameres | |
parent | 0bc7d285189caaffc13e4d6856baf895f72ed80c (diff) |
push either to hir_expand
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r-- | crates/ra_hir_def/src/nameres/raw.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index 636364628..f1896c0cc 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use std::{ops::Index, sync::Arc}; | 3 | use std::{ops::Index, sync::Arc}; |
4 | 4 | ||
5 | use hir_expand::{ast_id_map::AstIdMap, db::AstDatabase}; | 5 | use hir_expand::{ast_id_map::AstIdMap, db::AstDatabase, either::Either}; |
6 | use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; | 6 | use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; |
7 | use ra_syntax::{ | 7 | use ra_syntax::{ |
8 | ast::{self, AttrsOwner, NameOwner}, | 8 | ast::{self, AttrsOwner, NameOwner}, |
@@ -12,7 +12,6 @@ use ra_syntax::{ | |||
12 | use crate::{ | 12 | use crate::{ |
13 | attr::Attr, | 13 | attr::Attr, |
14 | db::DefDatabase2, | 14 | db::DefDatabase2, |
15 | either::Either, | ||
16 | hygiene::Hygiene, | 15 | hygiene::Hygiene, |
17 | name::{AsName, Name}, | 16 | name::{AsName, Name}, |
18 | path::Path, | 17 | path::Path, |
@@ -41,10 +40,8 @@ pub struct ImportSourceMap { | |||
41 | type ImportSourcePtr = Either<AstPtr<ast::UseTree>, AstPtr<ast::ExternCrateItem>>; | 40 | type ImportSourcePtr = Either<AstPtr<ast::UseTree>, AstPtr<ast::ExternCrateItem>>; |
42 | type ImportSource = Either<ast::UseTree, ast::ExternCrateItem>; | 41 | type ImportSource = Either<ast::UseTree, ast::ExternCrateItem>; |
43 | 42 | ||
44 | impl ImportSourcePtr { | 43 | fn to_node(ptr: ImportSourcePtr, file: &SourceFile) -> ImportSource { |
45 | fn to_node(self, file: &SourceFile) -> ImportSource { | 44 | ptr.map(|ptr| ptr.to_node(file.syntax()), |ptr| ptr.to_node(file.syntax())) |
46 | self.map(|ptr| ptr.to_node(file.syntax()), |ptr| ptr.to_node(file.syntax())) | ||
47 | } | ||
48 | } | 45 | } |
49 | 46 | ||
50 | impl ImportSourceMap { | 47 | impl ImportSourceMap { |
@@ -58,7 +55,7 @@ impl ImportSourceMap { | |||
58 | ModuleSource::Module(m) => m.syntax().ancestors().find_map(SourceFile::cast).unwrap(), | 55 | ModuleSource::Module(m) => m.syntax().ancestors().find_map(SourceFile::cast).unwrap(), |
59 | }; | 56 | }; |
60 | 57 | ||
61 | self.map[import].to_node(&file) | 58 | to_node(self.map[import], &file) |
62 | } | 59 | } |
63 | } | 60 | } |
64 | 61 | ||