From b05d6e53fb0e9a008dc2e1220b1201818e63ed2d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 30 Oct 2019 18:50:10 +0300 Subject: push either to hir_expand --- crates/ra_hir_def/src/nameres/raw.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'crates/ra_hir_def/src/nameres/raw.rs') 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 @@ use std::{ops::Index, sync::Arc}; -use hir_expand::{ast_id_map::AstIdMap, db::AstDatabase}; +use hir_expand::{ast_id_map::AstIdMap, db::AstDatabase, either::Either}; use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; use ra_syntax::{ ast::{self, AttrsOwner, NameOwner}, @@ -12,7 +12,6 @@ use ra_syntax::{ use crate::{ attr::Attr, db::DefDatabase2, - either::Either, hygiene::Hygiene, name::{AsName, Name}, path::Path, @@ -41,10 +40,8 @@ pub struct ImportSourceMap { type ImportSourcePtr = Either, AstPtr>; type ImportSource = Either; -impl ImportSourcePtr { - fn to_node(self, file: &SourceFile) -> ImportSource { - self.map(|ptr| ptr.to_node(file.syntax()), |ptr| ptr.to_node(file.syntax())) - } +fn to_node(ptr: ImportSourcePtr, file: &SourceFile) -> ImportSource { + ptr.map(|ptr| ptr.to_node(file.syntax()), |ptr| ptr.to_node(file.syntax())) } impl ImportSourceMap { @@ -58,7 +55,7 @@ impl ImportSourceMap { ModuleSource::Module(m) => m.syntax().ancestors().find_map(SourceFile::cast).unwrap(), }; - self.map[import].to_node(&file) + to_node(self.map[import], &file) } } -- cgit v1.2.3