diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs index c65446df4a..728046b0d4 100644 --- a/crates/ra_hir/src/adt.rs +++ b/crates/ra_hir/src/adt.rs @@ -7,8 +7,10 @@ use ra_arena::{impl_arena_id, Arena, RawId}; use ra_syntax::ast::{self, NameOwner, StructKind, TypeAscriptionOwner}; use crate::{ - type_ref::TypeRef, AsName, AstDatabase, Crate, DefDatabase, Enum, EnumVariant, FieldSource, - HasSource, HirDatabase, Name, Source, Struct, StructField, Union, + db::{AstDatabase, DefDatabase, HirDatabase}, + type_ref::TypeRef, + AsName, Crate, Enum, EnumVariant, FieldSource, HasSource, Name, Source, Struct, StructField, + Union, }; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 1bb2f9f284..2bac6122bd 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -8,6 +8,7 @@ use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; use crate::{ adt::{EnumVariantId, StructFieldId, VariantDef}, + db::{AstDatabase, DefDatabase, HirDatabase}, diagnostics::DiagnosticSink, expr::{validation::ExprValidator, Body, BodySourceMap}, generics::HasGenericParams, @@ -29,7 +30,7 @@ use crate::{ }, type_ref::Mutability, type_ref::TypeRef, - AsName, AstDatabase, AstId, DefDatabase, Either, HasSource, HirDatabase, Name, Ty, + AsName, AstId, Either, HasSource, Name, Ty, }; /// hir::Crate describes a single crate. It's the main interface with which diff --git a/crates/ra_hir/src/code_model/docs.rs b/crates/ra_hir/src/code_model/docs.rs index a2b4d8e975..99edc58140 100644 --- a/crates/ra_hir/src/code_model/docs.rs +++ b/crates/ra_hir/src/code_model/docs.rs @@ -3,8 +3,9 @@ use std::sync::Arc; use ra_syntax::ast; use crate::{ - AstDatabase, Const, DefDatabase, Enum, EnumVariant, FieldSource, Function, HasSource, - HirDatabase, MacroDef, Module, Static, Struct, StructField, Trait, TypeAlias, Union, + db::{AstDatabase, DefDatabase, HirDatabase}, + Const, Enum, EnumVariant, FieldSource, Function, HasSource, MacroDef, Module, Static, Struct, + StructField, Trait, TypeAlias, Union, }; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs index b9ffb0c7a8..c0cb27b477 100644 --- a/crates/ra_hir/src/code_model/src.rs +++ b/crates/ra_hir/src/code_model/src.rs @@ -4,9 +4,10 @@ use ra_syntax::{ }; use crate::{ - ids::AstItemDef, AstDatabase, Const, DefDatabase, Either, Enum, EnumVariant, FieldSource, - Function, HasBody, HirDatabase, HirFileId, MacroDef, Module, ModuleSource, Static, Struct, - StructField, Trait, TypeAlias, Union, + db::{AstDatabase, DefDatabase, HirDatabase}, + ids::AstItemDef, + Const, Either, Enum, EnumVariant, FieldSource, Function, HasBody, HirFileId, MacroDef, Module, + ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, }; #[derive(Debug, PartialEq, Eq, Clone, Copy)] diff --git a/crates/ra_hir/src/diagnostics.rs b/crates/ra_hir/src/diagnostics.rs index 475dd5766e..60da336954 100644 --- a/crates/ra_hir/src/diagnostics.rs +++ b/crates/ra_hir/src/diagnostics.rs @@ -3,7 +3,7 @@ use std::{any::Any, fmt}; use ra_syntax::{ast, AstNode, AstPtr, SyntaxNode, SyntaxNodePtr, TextRange}; use relative_path::RelativePathBuf; -use crate::{HirDatabase, HirFileId, Name, Source}; +use crate::{db::HirDatabase, HirFileId, Name, Source}; /// Diagnostic defines hir API for errors and warnings. /// diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index fc21e269f4..698fa671b5 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs @@ -9,10 +9,11 @@ use ra_syntax::{ast, AstPtr}; use rustc_hash::FxHashMap; use crate::{ + db::HirDatabase, path::GenericArgs, ty::primitive::{UncertainFloatTy, UncertainIntTy}, type_ref::{Mutability, TypeRef}, - DefWithBody, Either, HasSource, HirDatabase, Name, Path, Resolver, Source, + DefWithBody, Either, HasSource, Name, Path, Resolver, Source, }; pub use self::scope::ExprScopes; diff --git a/crates/ra_hir/src/expr/lower.rs b/crates/ra_hir/src/expr/lower.rs index 6afd80989d..8bd041ff08 100644 --- a/crates/ra_hir/src/expr/lower.rs +++ b/crates/ra_hir/src/expr/lower.rs @@ -9,12 +9,13 @@ use ra_syntax::{ use test_utils::tested_by; use crate::{ + db::HirDatabase, name::{AsName, Name, SELF_PARAM}, path::GenericArgs, ty::primitive::{FloatTy, IntTy, UncertainFloatTy, UncertainIntTy}, type_ref::TypeRef, - DefWithBody, Either, HirDatabase, HirFileId, MacroCallLoc, MacroFileKind, Mutability, Path, - Resolver, Source, + DefWithBody, Either, HirFileId, MacroCallLoc, MacroFileKind, Mutability, Path, Resolver, + Source, }; use super::{ diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs index b6d7f3fc14..de0983a7ed 100644 --- a/crates/ra_hir/src/expr/scope.rs +++ b/crates/ra_hir/src/expr/scope.rs @@ -4,8 +4,9 @@ use ra_arena::{impl_arena_id, Arena, RawId}; use rustc_hash::FxHashMap; use crate::{ + db::HirDatabase, expr::{Body, Expr, ExprId, Pat, PatId, Statement}, - DefWithBody, HirDatabase, Name, + DefWithBody, Name, }; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 1202913e2f..6a22e13189 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs @@ -5,12 +5,13 @@ use rustc_hash::FxHashSet; use crate::{ adt::AdtDef, + db::HirDatabase, diagnostics::{DiagnosticSink, MissingFields, MissingOkInTailExpr}, expr::AstPtr, name, path::{PathKind, PathSegment}, ty::{ApplicationTy, InferenceResult, Ty, TypeCtor}, - Function, HirDatabase, ModuleDef, Name, Path, PerNs, Resolution, + Function, ModuleDef, Name, Path, PerNs, Resolution, }; use super::{Expr, ExprId, RecordLitField}; diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index ec756f2c36..e0d0d4209a 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs @@ -8,7 +8,10 @@ use ra_db::{salsa, FileId}; use ra_prof::profile; use ra_syntax::{ast, AstNode, Parse, SyntaxNode}; -use crate::{AstDatabase, AstId, DefDatabase, FileAstId, InternDatabase, Module, Source}; +use crate::{ + db::{AstDatabase, DefDatabase, InternDatabase}, + AstId, FileAstId, Module, Source, +}; /// hir makes heavy use of ids: integer (u32) handlers to various things. You /// can think of id as a pointer (but without a lifetime) or a file descriptor diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs index 62a41719a4..162ab02b14 100644 --- a/crates/ra_hir/src/impl_block.rs +++ b/crates/ra_hir/src/impl_block.rs @@ -9,13 +9,13 @@ use ra_syntax::{ use crate::{ code_model::{Module, ModuleSource}, + db::{AstDatabase, DefDatabase, HirDatabase}, generics::HasGenericParams, ids::LocationCtx, resolve::Resolver, ty::Ty, type_ref::TypeRef, - AstDatabase, Const, DefDatabase, Function, HasSource, HirDatabase, HirFileId, Source, TraitRef, - TypeAlias, + Const, Function, HasSource, HirFileId, Source, TraitRef, TypeAlias, }; #[derive(Debug, Default, PartialEq, Eq)] diff --git a/crates/ra_hir/src/lang_item.rs b/crates/ra_hir/src/lang_item.rs index fd6609fb8a..832fdf1f57 100644 --- a/crates/ra_hir/src/lang_item.rs +++ b/crates/ra_hir/src/lang_item.rs @@ -4,8 +4,8 @@ use std::sync::Arc; use ra_syntax::{ast::AttrsOwner, SmolStr}; use crate::{ - AstDatabase, Crate, DefDatabase, Enum, Function, HasSource, HirDatabase, ImplBlock, Module, - ModuleDef, Static, Struct, Trait, + db::{AstDatabase, DefDatabase, HirDatabase}, + Crate, Enum, Function, HasSource, ImplBlock, Module, ModuleDef, Static, Struct, Trait, }; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index c3e5899216..7c2a68992c 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs @@ -49,7 +49,6 @@ mod code_model; mod marks; use crate::{ - db::{AstDatabase, DefDatabase, HirDatabase, InternDatabase}, ids::MacroFileKind, name::AsName, resolve::Resolver, diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs index fe90879b62..7de422128f 100644 --- a/crates/ra_hir/src/nameres.rs +++ b/crates/ra_hir/src/nameres.rs @@ -65,9 +65,12 @@ use rustc_hash::{FxHashMap, FxHashSet}; use test_utils::tested_by; use crate::{ - diagnostics::DiagnosticSink, either::Either, ids::MacroDefId, - nameres::diagnostics::DefDiagnostic, AstDatabase, AstId, BuiltinType, Crate, DefDatabase, - HirFileId, MacroDef, Module, ModuleDef, Name, Path, PathKind, Trait, + db::{AstDatabase, DefDatabase}, + diagnostics::DiagnosticSink, + either::Either, + ids::MacroDefId, + nameres::diagnostics::DefDiagnostic, + AstId, BuiltinType, Crate, HirFileId, MacroDef, Module, ModuleDef, Name, Path, PathKind, Trait, }; pub(crate) use self::raw::{ImportSourceMap, RawItems}; @@ -516,9 +519,10 @@ mod diagnostics { use relative_path::RelativePathBuf; use crate::{ + db::{AstDatabase, DefDatabase}, diagnostics::{DiagnosticSink, UnresolvedModule}, nameres::CrateModuleId, - AstDatabase, AstId, DefDatabase, + AstId, }; #[derive(Debug, PartialEq, Eq)] diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs index 34b90a666c..1c0d4369e4 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs @@ -4,6 +4,7 @@ use rustc_hash::FxHashMap; use test_utils::tested_by; use crate::{ + db::DefDatabase, either::Either, ids::{AstItemDef, LocationCtx, MacroCallId, MacroCallLoc, MacroDefId, MacroFileKind}, name::MACRO_RULES, @@ -13,8 +14,8 @@ use crate::{ raw, CrateDefMap, CrateModuleId, ItemOrMacro, ModuleData, ModuleDef, PerNs, ReachedFixedPoint, Resolution, ResolveMode, }, - AstId, Const, DefDatabase, Enum, Function, HirFileId, MacroDef, Module, Name, Path, Static, - Struct, Trait, TypeAlias, Union, + AstId, Const, Enum, Function, HirFileId, MacroDef, Module, Name, Path, Static, Struct, Trait, + TypeAlias, Union, }; pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> CrateDefMap { @@ -699,7 +700,7 @@ mod tests { use ra_db::SourceDatabase; use super::*; - use crate::{mock::MockDatabase, Crate, DefDatabase}; + use crate::{db::DefDatabase, mock::MockDatabase, Crate}; use ra_arena::Arena; use rustc_hash::FxHashSet; diff --git a/crates/ra_hir/src/nameres/mod_resolution.rs b/crates/ra_hir/src/nameres/mod_resolution.rs index 918c9591f5..a9e9eb9e65 100644 --- a/crates/ra_hir/src/nameres/mod_resolution.rs +++ b/crates/ra_hir/src/nameres/mod_resolution.rs @@ -6,7 +6,7 @@ use ra_db::{FileId, SourceRoot}; use ra_syntax::SmolStr; use relative_path::RelativePathBuf; -use crate::{DefDatabase, HirFileId, Name}; +use crate::{db::DefDatabase, HirFileId, Name}; #[derive(Clone, Copy)] pub(super) struct ParentModule<'a> { diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs index 129b047eb5..7963736e0d 100644 --- a/crates/ra_hir/src/nameres/raw.rs +++ b/crates/ra_hir/src/nameres/raw.rs @@ -8,8 +8,8 @@ use ra_syntax::{ use test_utils::tested_by; use crate::{ - AsName, AstDatabase, AstIdMap, DefDatabase, Either, FileAstId, HirFileId, ModuleSource, Name, - Path, + db::{AstDatabase, DefDatabase}, + AsName, AstIdMap, Either, FileAstId, HirFileId, ModuleSource, Name, Path, }; /// `RawItems` is a set of top-level items in a file (except for impls). diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index fdbe5e8b05..afdcd5415b 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs @@ -18,6 +18,7 @@ use ra_syntax::{ use rustc_hash::{FxHashMap, FxHashSet}; use crate::{ + db::HirDatabase, expr::{ self, scope::{ExprScopes, ScopeId}, @@ -27,9 +28,8 @@ use crate::{ name, path::{PathKind, PathSegment}, ty::method_resolution::implements_trait, - AsName, AstId, Const, Crate, DefWithBody, Either, Enum, Function, HasBody, HirDatabase, - HirFileId, MacroDef, Module, ModuleDef, Name, Path, PerNs, Resolution, Resolver, Static, - Struct, Trait, Ty, + AsName, AstId, Const, Crate, DefWithBody, Either, Enum, Function, HasBody, HirFileId, MacroDef, + Module, ModuleDef, Name, Path, PerNs, Resolution, Resolver, Static, Struct, Trait, Ty, }; /// Locates the module by `FileId`. Picks topmost module in the file. diff --git a/crates/ra_hir/src/source_id.rs b/crates/ra_hir/src/source_id.rs index 51cd65ddad..04574876da 100644 --- a/crates/ra_hir/src/source_id.rs +++ b/crates/ra_hir/src/source_id.rs @@ -7,7 +7,7 @@ use std::{ use ra_arena::{impl_arena_id, Arena, RawId}; use ra_syntax::{ast, AstNode, SyntaxNode, SyntaxNodePtr}; -use crate::{AstDatabase, HirFileId}; +use crate::{db::AstDatabase, HirFileId}; /// `AstId` points to an AST node in any file. /// diff --git a/crates/ra_hir/src/traits.rs b/crates/ra_hir/src/traits.rs index 6cdd3020af..4c2f7980dd 100644 --- a/crates/ra_hir/src/traits.rs +++ b/crates/ra_hir/src/traits.rs @@ -6,8 +6,10 @@ use std::sync::Arc; use ra_syntax::ast::{self, NameOwner}; use crate::{ - ids::LocationCtx, name::AsName, AstDatabase, Const, DefDatabase, Function, HasSource, Module, - Name, Trait, TypeAlias, + db::{AstDatabase, DefDatabase}, + ids::LocationCtx, + name::AsName, + Const, Function, HasSource, Module, Name, Trait, TypeAlias, }; #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs index caa17f64ea..5ba7cf2e0f 100644 --- a/crates/ra_hir/src/ty/autoderef.rs +++ b/crates/ra_hir/src/ty/autoderef.rs @@ -8,7 +8,7 @@ use std::iter::successors; use log::{info, warn}; use super::{traits::Solution, Canonical, Ty, TypeWalk}; -use crate::{name, HasGenericParams, HirDatabase, Resolver}; +use crate::{db::HirDatabase, name, HasGenericParams, Resolver}; const AUTODEREF_RECURSION_LIMIT: usize = 10; diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 0e6ebd3652..9244ff3cb9 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs @@ -35,6 +35,7 @@ use super::{ use crate::{ adt::VariantDef, code_model::{ModuleDef::Trait, TypeAlias}, + db::HirDatabase, diagnostics::DiagnosticSink, expr::{ self, Array, BinaryOp, BindingAnnotation, Body, Expr, ExprId, Literal, Pat, PatId, @@ -50,8 +51,8 @@ use crate::{ }, ty::infer::diagnostics::InferenceDiagnostic, type_ref::{Mutability, TypeRef}, - AdtDef, ConstData, DefWithBody, FnData, Function, HasBody, HirDatabase, ImplItem, ModuleDef, - Name, Path, StructField, + AdtDef, ConstData, DefWithBody, FnData, Function, HasBody, ImplItem, ModuleDef, Name, Path, + StructField, }; mod unify; @@ -1614,9 +1615,10 @@ impl Expectation { mod diagnostics { use crate::{ + db::HirDatabase, diagnostics::{DiagnosticSink, NoSuchField}, expr::ExprId, - Function, HasSource, HirDatabase, + Function, HasSource, }; #[derive(Debug, PartialEq, Eq, Clone)] diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index 480bae7401..0612298423 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs @@ -14,6 +14,7 @@ use super::{ }; use crate::{ adt::VariantDef, + db::HirDatabase, generics::HasGenericParams, generics::{GenericDef, WherePredicate}, nameres::Namespace, @@ -21,8 +22,8 @@ use crate::{ resolve::{Resolution, Resolver}, ty::AdtDef, type_ref::{TypeBound, TypeRef}, - BuiltinType, Const, Enum, EnumVariant, Function, HirDatabase, ModuleDef, Path, Static, Struct, - StructField, Trait, TypeAlias, Union, + BuiltinType, Const, Enum, EnumVariant, Function, ModuleDef, Path, Static, Struct, StructField, + Trait, TypeAlias, Union, }; impl Ty { diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index cf787bdaad..be63806d43 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs @@ -9,6 +9,7 @@ use rustc_hash::FxHashMap; use super::{autoderef, lower, Canonical, InEnvironment, TraitEnvironment, TraitRef}; use crate::{ + db::HirDatabase, generics::HasGenericParams, impl_block::{ImplBlock, ImplId, ImplItem}, nameres::CrateModuleId, @@ -16,7 +17,7 @@ use crate::{ traits::TraitItem, ty::primitive::{FloatBitness, UncertainFloatTy, UncertainIntTy}, ty::{Ty, TypeCtor}, - Crate, Function, HirDatabase, Module, Name, Trait, + Crate, Function, Module, Name, Trait, }; /// This is used as a key for indexing impls.