From f11237561c391eecba39c5ba57defa2dc7a27b21 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Nov 2019 14:02:08 +0300 Subject: Cleanup imports --- crates/ra_hir/src/code_model.rs | 11 ++++------- crates/ra_hir/src/code_model/src.rs | 3 +-- crates/ra_hir/src/debug.rs | 3 ++- crates/ra_hir/src/diagnostics.rs | 3 ++- crates/ra_hir/src/from_source.rs | 3 +-- crates/ra_hir/src/ids.rs | 6 ------ crates/ra_hir/src/lib.rs | 5 +++-- crates/ra_hir/src/source_binder.rs | 13 +++++++------ 8 files changed, 20 insertions(+), 27 deletions(-) (limited to 'crates/ra_hir/src') 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::{ per_ns::PerNs, resolver::{HasResolver, TypeNs}, type_ref::TypeRef, - ContainerId, HasModule, ImplId, LocalEnumVariantId, LocalImportId, LocalModuleId, - LocalStructFieldId, Lookup, ModuleId, UnionId, + AstItemDef, ConstId, ContainerId, EnumId, FunctionId, HasModule, ImplId, LocalEnumVariantId, + LocalImportId, LocalModuleId, LocalStructFieldId, Lookup, ModuleId, StaticId, StructId, + TraitId, TypeAliasId, UnionId, }; use hir_expand::{ diagnostics::DiagnosticSink, name::{self, AsName}, - AstId, + AstId, MacroDefId, }; use ra_db::{CrateId, Edition, FileId, FilePosition}; use ra_syntax::{ast, AstNode, SyntaxNode}; @@ -26,10 +27,6 @@ use ra_syntax::{ast, AstNode, SyntaxNode}; use crate::{ db::{DefDatabase, HirDatabase}, expr::{BindingAnnotation, Body, BodySourceMap, ExprValidator, Pat, PatId}, - ids::{ - AstItemDef, ConstId, EnumId, FunctionId, MacroDefId, StaticId, StructId, TraitId, - TypeAliasId, - }, ty::{InferenceResult, Namespace, TraitRef}, Either, HasSource, Name, Source, Ty, }; 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 @@ //! FIXME: write short doc here -use hir_def::{HasChildSource, HasSource as _, Lookup, VariantId}; +use hir_def::{AstItemDef, HasChildSource, HasSource as _, Lookup, VariantId}; use hir_expand::either::Either; use ra_syntax::ast::{self, AstNode}; use crate::{ db::{DefDatabase, HirDatabase}, - ids::AstItemDef, Const, Enum, EnumVariant, FieldSource, Function, HasBody, Import, MacroDef, Module, ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, }; 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 @@ use std::fmt; +use hir_expand::HirFileId; use ra_db::{CrateId, FileId}; -use crate::{db::HirDatabase, Crate, HirFileId, Module, Name}; +use crate::{db::HirDatabase, Crate, Module, Name}; impl Crate { 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 @@ use std::any::Any; +use hir_expand::HirFileId; use ra_syntax::{ast, AstNode, AstPtr, SyntaxNodePtr}; -use crate::{db::AstDatabase, HirFileId, Name, Source}; +use crate::{db::AstDatabase, Name, Source}; pub use hir_def::diagnostics::UnresolvedModule; pub 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 @@ //! FIXME: write short doc here -use hir_def::{ModuleId, StructId, StructOrUnionId, UnionId}; +use hir_def::{AstItemDef, LocationCtx, ModuleId, StructId, StructOrUnionId, UnionId}; use hir_expand::{name::AsName, AstId, MacroDefId, MacroDefKind}; use ra_syntax::{ ast::{self, AstNode, NameOwner}, @@ -9,7 +9,6 @@ use ra_syntax::{ use crate::{ db::{AstDatabase, DefDatabase, HirDatabase}, - ids::{AstItemDef, LocationCtx}, AssocItem, Const, DefWithBody, Enum, EnumVariant, FieldSource, Function, HasBody, HasSource, ImplBlock, Local, MacroDef, Module, ModuleDef, ModuleSource, Source, Static, Struct, 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 @@ use ra_db::salsa; -pub use hir_def::{ - AstItemDef, ConstId, EnumId, FunctionId, ItemLoc, LocationCtx, StaticId, StructId, TraitId, - TypeAliasId, -}; -pub use hir_expand::{HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile, MacroFileKind}; - macro_rules! impl_intern_key { ($name:ident) => { 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::{ }, expr::ExprScopes, from_source::FromSource, - ids::{HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile}, source_binder::{PathResolution, ScopeEntryWithSyntax, SourceAnalyzer}, ty::{ display::HirDisplay, @@ -73,4 +72,6 @@ pub use hir_def::{ path::{Path, PathKind}, type_ref::Mutability, }; -pub use hir_expand::{either::Either, name::Name, Source}; +pub use hir_expand::{ + either::Either, name::Name, HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile, Source, +}; 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::{ expr::{ExprId, PatId}, path::known, resolver::{self, resolver_for_scope, HasResolver, Resolver, TypeNs, ValueNs}, - DefWithBodyId, + DefWithBodyId, LocationCtx, +}; +use hir_expand::{ + name::AsName, AstId, HirFileId, MacroCallId, MacroCallLoc, MacroFileKind, Source, }; -use hir_expand::{name::AsName, AstId, MacroCallId, MacroCallLoc, MacroFileKind, Source}; use ra_syntax::{ ast::{self, AstNode}, match_ast, AstPtr, @@ -24,11 +26,10 @@ use ra_syntax::{ use crate::{ db::HirDatabase, expr::{BodySourceMap, ExprScopes, ScopeId}, - ids::LocationCtx, ty::method_resolution::{self, implements_trait}, Adt, AssocItem, Const, DefWithBody, Either, Enum, EnumVariant, FromSource, Function, - GenericParam, HasBody, HirFileId, Local, MacroDef, Module, Name, Path, ScopeDef, Static, - Struct, Trait, Ty, TypeAlias, + GenericParam, HasBody, Local, MacroDef, Module, Name, Path, ScopeDef, Static, Struct, Trait, + Ty, TypeAlias, }; fn try_get_resolver_for_node(db: &impl HirDatabase, node: Source<&SyntaxNode>) -> Option { @@ -544,7 +545,7 @@ fn adjust( } /// Given a `ast::MacroCall`, return what `MacroKindFile` it belongs to. -/// FIXME: Not completed +/// FIXME: Not completed fn to_macro_file_kind(macro_call: &ast::MacroCall) -> MacroFileKind { let syn = macro_call.syntax(); let parent = match syn.parent() { -- cgit v1.2.3