aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-24 11:02:08 +0000
committerAleksey Kladov <[email protected]>2019-11-24 11:02:08 +0000
commitf11237561c391eecba39c5ba57defa2dc7a27b21 (patch)
treea18f4ec5a06c6f08492582cd2a1832bb2fc6bb3f /crates/ra_hir/src
parentcfffea6dc81f802e32d0312b958f20fa1b1d8425 (diff)
Cleanup imports
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/code_model.rs11
-rw-r--r--crates/ra_hir/src/code_model/src.rs3
-rw-r--r--crates/ra_hir/src/debug.rs3
-rw-r--r--crates/ra_hir/src/diagnostics.rs3
-rw-r--r--crates/ra_hir/src/from_source.rs3
-rw-r--r--crates/ra_hir/src/ids.rs6
-rw-r--r--crates/ra_hir/src/lib.rs5
-rw-r--r--crates/ra_hir/src/source_binder.rs13
8 files changed, 20 insertions, 27 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index fd7776fb7..36ea8d8bf 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -12,13 +12,14 @@ use hir_def::{
12 per_ns::PerNs, 12 per_ns::PerNs,
13 resolver::{HasResolver, TypeNs}, 13 resolver::{HasResolver, TypeNs},
14 type_ref::TypeRef, 14 type_ref::TypeRef,
15 ContainerId, HasModule, ImplId, LocalEnumVariantId, LocalImportId, LocalModuleId, 15 AstItemDef, ConstId, ContainerId, EnumId, FunctionId, HasModule, ImplId, LocalEnumVariantId,
16 LocalStructFieldId, Lookup, ModuleId, UnionId, 16 LocalImportId, LocalModuleId, LocalStructFieldId, Lookup, ModuleId, StaticId, StructId,
17 TraitId, TypeAliasId, UnionId,
17}; 18};
18use hir_expand::{ 19use hir_expand::{
19 diagnostics::DiagnosticSink, 20 diagnostics::DiagnosticSink,
20 name::{self, AsName}, 21 name::{self, AsName},
21 AstId, 22 AstId, MacroDefId,
22}; 23};
23use ra_db::{CrateId, Edition, FileId, FilePosition}; 24use ra_db::{CrateId, Edition, FileId, FilePosition};
24use ra_syntax::{ast, AstNode, SyntaxNode}; 25use ra_syntax::{ast, AstNode, SyntaxNode};
@@ -26,10 +27,6 @@ use ra_syntax::{ast, AstNode, SyntaxNode};
26use crate::{ 27use crate::{
27 db::{DefDatabase, HirDatabase}, 28 db::{DefDatabase, HirDatabase},
28 expr::{BindingAnnotation, Body, BodySourceMap, ExprValidator, Pat, PatId}, 29 expr::{BindingAnnotation, Body, BodySourceMap, ExprValidator, Pat, PatId},
29 ids::{
30 AstItemDef, ConstId, EnumId, FunctionId, MacroDefId, StaticId, StructId, TraitId,
31 TypeAliasId,
32 },
33 ty::{InferenceResult, Namespace, TraitRef}, 30 ty::{InferenceResult, Namespace, TraitRef},
34 Either, HasSource, Name, Source, Ty, 31 Either, HasSource, Name, Source, Ty,
35}; 32};
diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs
index b7bafe23d..59cda2e89 100644
--- a/crates/ra_hir/src/code_model/src.rs
+++ b/crates/ra_hir/src/code_model/src.rs
@@ -1,12 +1,11 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use hir_def::{HasChildSource, HasSource as _, Lookup, VariantId}; 3use hir_def::{AstItemDef, HasChildSource, HasSource as _, Lookup, VariantId};
4use hir_expand::either::Either; 4use hir_expand::either::Either;
5use ra_syntax::ast::{self, AstNode}; 5use ra_syntax::ast::{self, AstNode};
6 6
7use crate::{ 7use crate::{
8 db::{DefDatabase, HirDatabase}, 8 db::{DefDatabase, HirDatabase},
9 ids::AstItemDef,
10 Const, Enum, EnumVariant, FieldSource, Function, HasBody, Import, MacroDef, Module, 9 Const, Enum, EnumVariant, FieldSource, Function, HasBody, Import, MacroDef, Module,
11 ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, 10 ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union,
12}; 11};
diff --git a/crates/ra_hir/src/debug.rs b/crates/ra_hir/src/debug.rs
index 8ec371f6e..7a2810f71 100644
--- a/crates/ra_hir/src/debug.rs
+++ b/crates/ra_hir/src/debug.rs
@@ -22,9 +22,10 @@
22 22
23use std::fmt; 23use std::fmt;
24 24
25use hir_expand::HirFileId;
25use ra_db::{CrateId, FileId}; 26use ra_db::{CrateId, FileId};
26 27
27use crate::{db::HirDatabase, Crate, HirFileId, Module, Name}; 28use crate::{db::HirDatabase, Crate, Module, Name};
28 29
29impl Crate { 30impl Crate {
30 pub fn debug(self, db: &impl HirDebugDatabase) -> impl fmt::Debug + '_ { 31 pub fn debug(self, db: &impl HirDebugDatabase) -> impl fmt::Debug + '_ {
diff --git a/crates/ra_hir/src/diagnostics.rs b/crates/ra_hir/src/diagnostics.rs
index 7d1b64858..dafacba70 100644
--- a/crates/ra_hir/src/diagnostics.rs
+++ b/crates/ra_hir/src/diagnostics.rs
@@ -2,9 +2,10 @@
2 2
3use std::any::Any; 3use std::any::Any;
4 4
5use hir_expand::HirFileId;
5use ra_syntax::{ast, AstNode, AstPtr, SyntaxNodePtr}; 6use ra_syntax::{ast, AstNode, AstPtr, SyntaxNodePtr};
6 7
7use crate::{db::AstDatabase, HirFileId, Name, Source}; 8use crate::{db::AstDatabase, Name, Source};
8 9
9pub use hir_def::diagnostics::UnresolvedModule; 10pub use hir_def::diagnostics::UnresolvedModule;
10pub use hir_expand::diagnostics::{AstDiagnostic, Diagnostic, DiagnosticSink}; 11pub use hir_expand::diagnostics::{AstDiagnostic, Diagnostic, DiagnosticSink};
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index b86307c58..c3c3b05ed 100644
--- a/crates/ra_hir/src/from_source.rs
+++ b/crates/ra_hir/src/from_source.rs
@@ -1,6 +1,6 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use hir_def::{ModuleId, StructId, StructOrUnionId, UnionId}; 3use hir_def::{AstItemDef, LocationCtx, ModuleId, StructId, StructOrUnionId, UnionId};
4use hir_expand::{name::AsName, AstId, MacroDefId, MacroDefKind}; 4use hir_expand::{name::AsName, AstId, MacroDefId, MacroDefKind};
5use ra_syntax::{ 5use ra_syntax::{
6 ast::{self, AstNode, NameOwner}, 6 ast::{self, AstNode, NameOwner},
@@ -9,7 +9,6 @@ use ra_syntax::{
9 9
10use crate::{ 10use crate::{
11 db::{AstDatabase, DefDatabase, HirDatabase}, 11 db::{AstDatabase, DefDatabase, HirDatabase},
12 ids::{AstItemDef, LocationCtx},
13 AssocItem, Const, DefWithBody, Enum, EnumVariant, FieldSource, Function, HasBody, HasSource, 12 AssocItem, Const, DefWithBody, Enum, EnumVariant, FieldSource, Function, HasBody, HasSource,
14 ImplBlock, Local, MacroDef, Module, ModuleDef, ModuleSource, Source, Static, Struct, 13 ImplBlock, Local, MacroDef, Module, ModuleDef, ModuleSource, Source, Static, Struct,
15 StructField, Trait, TypeAlias, Union, VariantDef, 14 StructField, Trait, TypeAlias, Union, VariantDef,
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index 2b59365fb..145837f7f 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -7,12 +7,6 @@
7 7
8use ra_db::salsa; 8use ra_db::salsa;
9 9
10pub use hir_def::{
11 AstItemDef, ConstId, EnumId, FunctionId, ItemLoc, LocationCtx, StaticId, StructId, TraitId,
12 TypeAliasId,
13};
14pub use hir_expand::{HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile, MacroFileKind};
15
16macro_rules! impl_intern_key { 10macro_rules! impl_intern_key {
17 ($name:ident) => { 11 ($name:ident) => {
18 impl salsa::InternKey for $name { 12 impl salsa::InternKey for $name {
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs
index e51d4d063..239798bcc 100644
--- a/crates/ra_hir/src/lib.rs
+++ b/crates/ra_hir/src/lib.rs
@@ -58,7 +58,6 @@ pub use crate::{
58 }, 58 },
59 expr::ExprScopes, 59 expr::ExprScopes,
60 from_source::FromSource, 60 from_source::FromSource,
61 ids::{HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile},
62 source_binder::{PathResolution, ScopeEntryWithSyntax, SourceAnalyzer}, 61 source_binder::{PathResolution, ScopeEntryWithSyntax, SourceAnalyzer},
63 ty::{ 62 ty::{
64 display::HirDisplay, 63 display::HirDisplay,
@@ -73,4 +72,6 @@ pub use hir_def::{
73 path::{Path, PathKind}, 72 path::{Path, PathKind},
74 type_ref::Mutability, 73 type_ref::Mutability,
75}; 74};
76pub use hir_expand::{either::Either, name::Name, Source}; 75pub use hir_expand::{
76 either::Either, name::Name, HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile, Source,
77};
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 797f90d50..0a836c913 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -11,9 +11,11 @@ use hir_def::{
11 expr::{ExprId, PatId}, 11 expr::{ExprId, PatId},
12 path::known, 12 path::known,
13 resolver::{self, resolver_for_scope, HasResolver, Resolver, TypeNs, ValueNs}, 13 resolver::{self, resolver_for_scope, HasResolver, Resolver, TypeNs, ValueNs},
14 DefWithBodyId, 14 DefWithBodyId, LocationCtx,
15};
16use hir_expand::{
17 name::AsName, AstId, HirFileId, MacroCallId, MacroCallLoc, MacroFileKind, Source,
15}; 18};
16use hir_expand::{name::AsName, AstId, MacroCallId, MacroCallLoc, MacroFileKind, Source};
17use ra_syntax::{ 19use ra_syntax::{
18 ast::{self, AstNode}, 20 ast::{self, AstNode},
19 match_ast, AstPtr, 21 match_ast, AstPtr,
@@ -24,11 +26,10 @@ use ra_syntax::{
24use crate::{ 26use crate::{
25 db::HirDatabase, 27 db::HirDatabase,
26 expr::{BodySourceMap, ExprScopes, ScopeId}, 28 expr::{BodySourceMap, ExprScopes, ScopeId},
27 ids::LocationCtx,
28 ty::method_resolution::{self, implements_trait}, 29 ty::method_resolution::{self, implements_trait},
29 Adt, AssocItem, Const, DefWithBody, Either, Enum, EnumVariant, FromSource, Function, 30 Adt, AssocItem, Const, DefWithBody, Either, Enum, EnumVariant, FromSource, Function,
30 GenericParam, HasBody, HirFileId, Local, MacroDef, Module, Name, Path, ScopeDef, Static, 31 GenericParam, HasBody, Local, MacroDef, Module, Name, Path, ScopeDef, Static, Struct, Trait,
31 Struct, Trait, Ty, TypeAlias, 32 Ty, TypeAlias,
32}; 33};
33 34
34fn try_get_resolver_for_node(db: &impl HirDatabase, node: Source<&SyntaxNode>) -> Option<Resolver> { 35fn try_get_resolver_for_node(db: &impl HirDatabase, node: Source<&SyntaxNode>) -> Option<Resolver> {
@@ -544,7 +545,7 @@ fn adjust(
544} 545}
545 546
546/// Given a `ast::MacroCall`, return what `MacroKindFile` it belongs to. 547/// Given a `ast::MacroCall`, return what `MacroKindFile` it belongs to.
547/// FIXME: Not completed 548/// FIXME: Not completed
548fn to_macro_file_kind(macro_call: &ast::MacroCall) -> MacroFileKind { 549fn to_macro_file_kind(macro_call: &ast::MacroCall) -> MacroFileKind {
549 let syn = macro_call.syntax(); 550 let syn = macro_call.syntax();
550 let parent = match syn.parent() { 551 let parent = match syn.parent() {