From 88267c86c0c49de395973574d2516ab904091cfb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 6 Feb 2020 12:52:32 +0100 Subject: cleanup imports --- crates/ra_ide/src/assists.rs | 10 +++--- crates/ra_ide/src/call_hierarchy.rs | 2 +- crates/ra_ide/src/call_info.rs | 6 ++-- crates/ra_ide/src/completion.rs | 5 +-- crates/ra_ide/src/completion/completion_context.rs | 7 ++-- crates/ra_ide/src/db.rs | 1 - crates/ra_ide/src/diagnostics.rs | 3 +- crates/ra_ide/src/display/function_signature.rs | 17 ++++------ crates/ra_ide/src/display/navigation_target.rs | 3 +- crates/ra_ide/src/expand.rs | 3 +- crates/ra_ide/src/expand_macro.rs | 25 +++++++------- crates/ra_ide/src/extend_selection.rs | 12 ++++--- crates/ra_ide/src/goto_definition.rs | 3 +- crates/ra_ide/src/goto_type_definition.rs | 4 +-- crates/ra_ide/src/hover.rs | 2 +- crates/ra_ide/src/impls.rs | 3 +- crates/ra_ide/src/imports_locator.rs | 15 +++++---- crates/ra_ide/src/inlay_hints.rs | 3 +- crates/ra_ide/src/lib.rs | 38 ++++++++++------------ crates/ra_ide/src/parent_module.rs | 3 +- crates/ra_ide/src/references.rs | 5 ++- crates/ra_ide/src/references/classify.rs | 2 +- crates/ra_ide/src/references/name_definition.rs | 2 +- crates/ra_ide/src/references/rename.rs | 4 +-- crates/ra_ide/src/references/search_scope.rs | 2 +- crates/ra_ide/src/runnables.rs | 3 +- crates/ra_ide/src/status.rs | 10 +++--- crates/ra_ide/src/syntax_highlighting.rs | 2 +- crates/ra_ide/src/syntax_tree.rs | 2 +- crates/ra_ide/src/typing.rs | 3 +- 30 files changed, 101 insertions(+), 99 deletions(-) delete mode 100644 crates/ra_ide/src/db.rs (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/assists.rs b/crates/ra_ide/src/assists.rs index c43c45c65..f26047570 100644 --- a/crates/ra_ide/src/assists.rs +++ b/crates/ra_ide/src/assists.rs @@ -1,13 +1,13 @@ //! FIXME: write short doc here +use either::Either; +use ra_assists::{AssistAction, AssistLabel}; use ra_db::{FilePosition, FileRange}; +use ra_ide_db::RootDatabase; + +use crate::{imports_locator::ImportsLocatorIde, FileId, SourceChange, SourceFileEdit}; -use crate::{ - db::RootDatabase, imports_locator::ImportsLocatorIde, FileId, SourceChange, SourceFileEdit, -}; -use either::Either; pub use ra_assists::AssistId; -use ra_assists::{AssistAction, AssistLabel}; #[derive(Debug)] pub struct Assist { diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs index aa5d60c7b..f984f40ad 100644 --- a/crates/ra_ide/src/call_hierarchy.rs +++ b/crates/ra_ide/src/call_hierarchy.rs @@ -3,6 +3,7 @@ use indexmap::IndexMap; use hir::db::AstDatabase; +use ra_ide_db::RootDatabase; use ra_syntax::{ ast::{self, DocCommentsOwner}, match_ast, AstNode, TextRange, @@ -10,7 +11,6 @@ use ra_syntax::{ use crate::{ call_info::FnCallNode, - db::RootDatabase, display::{ShortLabel, ToNav}, expand::descend_into_macros, goto_definition, references, FilePosition, NavigationTarget, RangeInfo, diff --git a/crates/ra_ide/src/call_info.rs b/crates/ra_ide/src/call_info.rs index 72a68522e..f2b29306e 100644 --- a/crates/ra_ide/src/call_info.rs +++ b/crates/ra_ide/src/call_info.rs @@ -1,15 +1,13 @@ //! FIXME: write short doc here use hir::db::AstDatabase; +use ra_ide_db::RootDatabase; use ra_syntax::{ ast::{self, ArgListOwner}, match_ast, AstNode, SyntaxNode, }; - use test_utils::tested_by; -use crate::{ - db::RootDatabase, expand::descend_into_macros, CallInfo, FilePosition, FunctionSignature, -}; +use crate::{expand::descend_into_macros, CallInfo, FilePosition, FunctionSignature}; /// Computes parameter information for the given call expression. pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option { diff --git a/crates/ra_ide/src/completion.rs b/crates/ra_ide/src/completion.rs index abe1f36ce..fedc02e14 100644 --- a/crates/ra_ide/src/completion.rs +++ b/crates/ra_ide/src/completion.rs @@ -17,6 +17,7 @@ mod complete_postfix; mod complete_macro_in_item_position; use ra_db::SourceDatabase; +use ra_ide_db::RootDatabase; #[cfg(test)] use crate::completion::completion_item::do_completion; @@ -25,7 +26,7 @@ use crate::{ completion_context::CompletionContext, completion_item::{CompletionKind, Completions}, }, - db, FilePosition, + FilePosition, }; pub use crate::completion::completion_item::{ @@ -54,7 +55,7 @@ pub use crate::completion::completion_item::{ /// `foo` *should* be present among the completion variants. Filtering by /// identifier prefix/fuzzy match should be done higher in the stack, together /// with ordering of completions (currently this is done by the client). -pub(crate) fn completions(db: &db::RootDatabase, position: FilePosition) -> Option { +pub(crate) fn completions(db: &RootDatabase, position: FilePosition) -> Option { let original_parse = db.parse(position.file_id); let ctx = CompletionContext::new(db, &original_parse, position)?; diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index deaacda6c..5a0407fd7 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs @@ -1,5 +1,6 @@ //! FIXME: write short doc here +use ra_ide_db::RootDatabase; use ra_syntax::{ algo::{find_covering_element, find_node_at_offset}, ast, AstNode, Parse, SourceFile, @@ -8,13 +9,13 @@ use ra_syntax::{ }; use ra_text_edit::AtomTextEdit; -use crate::{db, FilePosition}; +use crate::FilePosition; /// `CompletionContext` is created early during completion to figure out, where /// exactly is the cursor, syntax-wise. #[derive(Debug)] pub(crate) struct CompletionContext<'a> { - pub(super) db: &'a db::RootDatabase, + pub(super) db: &'a RootDatabase, pub(super) analyzer: hir::SourceAnalyzer, pub(super) offset: TextUnit, pub(super) token: SyntaxToken, @@ -48,7 +49,7 @@ pub(crate) struct CompletionContext<'a> { impl<'a> CompletionContext<'a> { pub(super) fn new( - db: &'a db::RootDatabase, + db: &'a RootDatabase, original_parse: &'a Parse, position: FilePosition, ) -> Option> { diff --git a/crates/ra_ide/src/db.rs b/crates/ra_ide/src/db.rs deleted file mode 100644 index 2849cdb02..000000000 --- a/crates/ra_ide/src/db.rs +++ /dev/null @@ -1 +0,0 @@ -pub(crate) use crate::ide_db::*; diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index f403b3bcf..22bd49723 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs @@ -5,6 +5,7 @@ use std::cell::RefCell; use hir::diagnostics::{AstDiagnostic, Diagnostic as _, DiagnosticSink}; use itertools::Itertools; use ra_db::{RelativePath, SourceDatabase, SourceDatabaseExt}; +use ra_ide_db::RootDatabase; use ra_prof::profile; use ra_syntax::{ algo, @@ -13,7 +14,7 @@ use ra_syntax::{ }; use ra_text_edit::{TextEdit, TextEditBuilder}; -use crate::{db::RootDatabase, Diagnostic, FileId, FileSystemEdit, SourceChange, SourceFileEdit}; +use crate::{Diagnostic, FileId, FileSystemEdit, SourceChange, SourceFileEdit}; #[derive(Debug, Copy, Clone)] pub enum Severity { diff --git a/crates/ra_ide/src/display/function_signature.rs b/crates/ra_ide/src/display/function_signature.rs index 1e4a472b4..c23e08e9a 100644 --- a/crates/ra_ide/src/display/function_signature.rs +++ b/crates/ra_ide/src/display/function_signature.rs @@ -4,13 +4,11 @@ use std::fmt::{self, Display}; use hir::{Docs, Documentation, HasSource, HirDisplay}; use join_to_string::join; +use ra_ide_db::RootDatabase; use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner}; use std::convert::From; -use crate::{ - db, - display::{generic_parameters, where_predicates}, -}; +use crate::display::{generic_parameters, where_predicates}; #[derive(Debug)] pub enum CallableKind { @@ -48,13 +46,13 @@ impl FunctionSignature { self } - pub(crate) fn from_hir(db: &db::RootDatabase, function: hir::Function) -> Self { + pub(crate) fn from_hir(db: &RootDatabase, function: hir::Function) -> Self { let doc = function.docs(db); let ast_node = function.source(db).value; FunctionSignature::from(&ast_node).with_doc_opt(doc) } - pub(crate) fn from_struct(db: &db::RootDatabase, st: hir::Struct) -> Option { + pub(crate) fn from_struct(db: &RootDatabase, st: hir::Struct) -> Option { let node: ast::StructDef = st.source(db).value; match node.kind() { ast::StructKind::Record(_) => return None, @@ -86,10 +84,7 @@ impl FunctionSignature { ) } - pub(crate) fn from_enum_variant( - db: &db::RootDatabase, - variant: hir::EnumVariant, - ) -> Option { + pub(crate) fn from_enum_variant(db: &RootDatabase, variant: hir::EnumVariant) -> Option { let node: ast::EnumVariant = variant.source(db).value; match node.kind() { ast::StructKind::Record(_) | ast::StructKind::Unit => return None, @@ -126,7 +121,7 @@ impl FunctionSignature { ) } - pub(crate) fn from_macro(db: &db::RootDatabase, macro_def: hir::MacroDef) -> Option { + pub(crate) fn from_macro(db: &RootDatabase, macro_def: hir::MacroDef) -> Option { let node: ast::MacroCall = macro_def.source(db).value; let params = vec![]; diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index b2af3479c..906aab1eb 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -3,6 +3,7 @@ use either::Either; use hir::{AssocItem, FieldSource, HasSource, InFile, ModuleSource}; use ra_db::{FileId, SourceDatabase}; +use ra_ide_db::RootDatabase; use ra_syntax::{ ast::{self, DocCommentsOwner, NameOwner}, match_ast, AstNode, SmolStr, @@ -10,7 +11,7 @@ use ra_syntax::{ TextRange, }; -use crate::{db::RootDatabase, expand::original_range, FileSymbol}; +use crate::{expand::original_range, FileSymbol}; use super::short_label::ShortLabel; diff --git a/crates/ra_ide/src/expand.rs b/crates/ra_ide/src/expand.rs index 831438c09..9f3aaa3a3 100644 --- a/crates/ra_ide/src/expand.rs +++ b/crates/ra_ide/src/expand.rs @@ -3,9 +3,10 @@ use std::iter::successors; use hir::{InFile, Origin}; use ra_db::FileId; +use ra_ide_db::RootDatabase; use ra_syntax::{ast, AstNode, SyntaxNode, SyntaxToken, TextRange}; -use crate::{db::RootDatabase, FileRange}; +use crate::FileRange; pub(crate) fn original_range(db: &RootDatabase, node: InFile<&SyntaxNode>) -> FileRange { if let Some((range, Origin::Call)) = original_range_and_origin(db, node) { diff --git a/crates/ra_ide/src/expand_macro.rs b/crates/ra_ide/src/expand_macro.rs index 0f7b6e875..af2783bef 100644 --- a/crates/ra_ide/src/expand_macro.rs +++ b/crates/ra_ide/src/expand_macro.rs @@ -1,14 +1,15 @@ //! This modules implements "expand macro" functionality in the IDE -use crate::{db::RootDatabase, FilePosition}; use hir::db::AstDatabase; use ra_db::SourceDatabase; -use rustc_hash::FxHashMap; - +use ra_ide_db::RootDatabase; use ra_syntax::{ algo::{find_node_at_offset, replace_descendants}, ast, AstNode, NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode, WalkEvent, T, }; +use rustc_hash::FxHashMap; + +use crate::FilePosition; pub struct ExpandedMacro { pub name: String, @@ -185,7 +186,7 @@ fn some_thing() -> u32 { //- /lib.rs macro_rules! match_ast { (match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) }; - + (match ($node:expr) { $( ast::$ast:ident($it:ident) => $res:block, )* _ => $catch_all:expr $(,)? @@ -193,7 +194,7 @@ fn some_thing() -> u32 { $( if let Some($it) = ast::$ast::cast($node.clone()) $res else )* { $catch_all } }}; - } + } fn main() { mat<|>ch_ast! { @@ -227,11 +228,11 @@ fn some_thing() -> u32 { r#" //- /lib.rs macro_rules! match_ast { - (match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) }; + (match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) }; (match ($node:expr) {}) => {{}}; - } + } - fn main() { + fn main() { let p = f(|it| { let res = mat<|>ch_ast! { match c {}}; Some(res) @@ -254,9 +255,9 @@ fn some_thing() -> u32 { } macro_rules! foo { () => {bar!()}; - } + } - fn main() { + fn main() { let res = fo<|>o!(); } "#, @@ -277,9 +278,9 @@ fn some_thing() -> u32 { } macro_rules! foo { () => {$crate::bar!()}; - } + } - fn main() { + fn main() { let res = fo<|>o!(); } "#, diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index 930e0c4c2..726963a33 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs @@ -1,6 +1,10 @@ //! FIXME: write short doc here +use std::iter::successors; + +use hir::db::AstDatabase; use ra_db::SourceDatabase; +use ra_ide_db::RootDatabase; use ra_syntax::{ algo::find_covering_element, ast::{self, AstNode, AstToken}, @@ -9,9 +13,7 @@ use ra_syntax::{ SyntaxNode, SyntaxToken, TextRange, TextUnit, TokenAtOffset, T, }; -use crate::{db::RootDatabase, expand::descend_into_macros, FileId, FileRange}; -use hir::db::AstDatabase; -use std::iter::successors; +use crate::{expand::descend_into_macros, FileId, FileRange}; pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange { let src = db.parse(frange.file_id).tree(); @@ -512,8 +514,8 @@ fn bar(){} fn test_extend_trait_bounds_list_in_where_clause() { do_check( r#" -fn foo() - where +fn foo() + where R: req::Request + 'static, R::Params: DeserializeOwned<|> + panic::UnwindSafe + 'static, R::Result: Serialize + 'static, diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index b67e32626..e9329a72c 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs @@ -1,6 +1,7 @@ //! FIXME: write short doc here use hir::{db::AstDatabase, InFile, SourceBinder}; +use ra_ide_db::{symbol_index, RootDatabase}; use ra_syntax::{ ast::{self, DocCommentsOwner}, match_ast, AstNode, @@ -9,10 +10,8 @@ use ra_syntax::{ }; use crate::{ - db::RootDatabase, display::{ShortLabel, ToNav}, expand::descend_into_macros, - ide_db::symbol_index, references::{classify_name_ref, NameKind::*}, FilePosition, NavigationTarget, RangeInfo, }; diff --git a/crates/ra_ide/src/goto_type_definition.rs b/crates/ra_ide/src/goto_type_definition.rs index ce8b6c72a..11ad6d137 100644 --- a/crates/ra_ide/src/goto_type_definition.rs +++ b/crates/ra_ide/src/goto_type_definition.rs @@ -1,11 +1,11 @@ //! FIXME: write short doc here use hir::db::AstDatabase; +use ra_ide_db::RootDatabase; use ra_syntax::{ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset}; use crate::{ - db::RootDatabase, display::ToNav, expand::descend_into_macros, FilePosition, NavigationTarget, - RangeInfo, + display::ToNav, expand::descend_into_macros, FilePosition, NavigationTarget, RangeInfo, }; pub(crate) fn goto_type_definition( diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 6661e5cb2..315b88190 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -2,6 +2,7 @@ use hir::{db::AstDatabase, Adt, HasSource, HirDisplay, SourceBinder}; use ra_db::SourceDatabase; +use ra_ide_db::RootDatabase; use ra_syntax::{ algo::find_covering_element, ast::{self, DocCommentsOwner}, @@ -11,7 +12,6 @@ use ra_syntax::{ }; use crate::{ - db::RootDatabase, display::{macro_label, rust_code_markup, rust_code_markup_with_doc, ShortLabel}, expand::descend_into_macros, references::{classify_name, classify_name_ref, NameKind, NameKind::*}, diff --git a/crates/ra_ide/src/impls.rs b/crates/ra_ide/src/impls.rs index 9834025d3..64a2dadc8 100644 --- a/crates/ra_ide/src/impls.rs +++ b/crates/ra_ide/src/impls.rs @@ -2,9 +2,10 @@ use hir::{Crate, ImplBlock, SourceBinder}; use ra_db::SourceDatabase; +use ra_ide_db::RootDatabase; use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; -use crate::{db::RootDatabase, display::ToNav, FilePosition, NavigationTarget, RangeInfo}; +use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; pub(crate) fn goto_implementation( db: &RootDatabase, diff --git a/crates/ra_ide/src/imports_locator.rs b/crates/ra_ide/src/imports_locator.rs index 9e5e6cadf..cfd58aafe 100644 --- a/crates/ra_ide/src/imports_locator.rs +++ b/crates/ra_ide/src/imports_locator.rs @@ -1,17 +1,20 @@ //! This module contains an import search funcionality that is provided to the ra_assists module. //! Later, this should be moved away to a separate crate that is accessible from the ra_assists module. -use crate::{ - db::RootDatabase, - ide_db::symbol_index::{self, FileSymbol}, - references::{classify_name, NameDefinition, NameKind}, - Query, -}; use hir::{db::HirDatabase, ModuleDef, SourceBinder}; use ra_assists::ImportsLocator; +use ra_ide_db::{ + symbol_index::{self, FileSymbol}, + RootDatabase, +}; use ra_prof::profile; use ra_syntax::{ast, AstNode, SyntaxKind::NAME}; +use crate::{ + references::{classify_name, NameDefinition, NameKind}, + Query, +}; + pub(crate) struct ImportsLocatorIde<'a> { source_binder: SourceBinder<'a, RootDatabase>, } diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index de447a5aa..6b0d3d996 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs @@ -2,13 +2,14 @@ use hir::{HirDisplay, SourceAnalyzer, SourceBinder}; use once_cell::unsync::Lazy; +use ra_ide_db::RootDatabase; use ra_prof::profile; use ra_syntax::{ ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner}, match_ast, SmolStr, SourceFile, SyntaxKind, SyntaxNode, TextRange, }; -use crate::{db::RootDatabase, FileId, FunctionSignature}; +use crate::{FileId, FunctionSignature}; #[derive(Debug, PartialEq, Eq)] pub enum InlayKind { diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 1527b27d4..013b960c1 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs @@ -10,11 +10,6 @@ // For proving that RootDatabase is RefUnwindSafe. #![recursion_limit = "128"] -mod ide_db { - pub use ra_ide_db::*; -} - -mod db; pub mod mock_analysis; mod source_change; @@ -56,13 +51,13 @@ use ra_db::{ salsa::{self, ParallelDatabase}, CheckCanceled, Env, FileLoader, SourceDatabase, }; +use ra_ide_db::{ + symbol_index::{self, FileSymbol}, + LineIndexDatabase, +}; use ra_syntax::{SourceFile, TextRange, TextUnit}; -use crate::{ - db::LineIndexDatabase, - display::ToNav, - ide_db::symbol_index::{self, FileSymbol}, -}; +use crate::display::ToNav; pub use crate::{ assists::{Assist, AssistId}, @@ -73,13 +68,6 @@ pub use crate::{ expand_macro::ExpandedMacro, folding_ranges::{Fold, FoldKind}, hover::HoverResult, - ide_db::{ - change::{AnalysisChange, LibraryData}, - feature_flags::FeatureFlags, - line_index::{LineCol, LineIndex}, - line_index_utils::translate_offset_with_edit, - symbol_index::Query, - }, inlay_hints::{InlayHint, InlayKind}, references::{ Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult, SearchScope, @@ -93,6 +81,14 @@ pub use hir::Documentation; pub use ra_db::{ Canceled, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRootId, }; +pub use ra_ide_db::{ + change::{AnalysisChange, LibraryData}, + feature_flags::FeatureFlags, + line_index::{LineCol, LineIndex}, + line_index_utils::translate_offset_with_edit, + symbol_index::Query, + RootDatabase, +}; pub type Cancelable = Result; @@ -128,7 +124,7 @@ pub struct CallInfo { /// `AnalysisHost` stores the current state of the world. #[derive(Debug)] pub struct AnalysisHost { - db: db::RootDatabase, + db: RootDatabase, } impl Default for AnalysisHost { @@ -139,7 +135,7 @@ impl Default for AnalysisHost { impl AnalysisHost { pub fn new(lru_capcity: Option, feature_flags: FeatureFlags) -> AnalysisHost { - AnalysisHost { db: db::RootDatabase::new(lru_capcity, feature_flags) } + AnalysisHost { db: RootDatabase::new(lru_capcity, feature_flags) } } /// Returns a snapshot of the current state, which you can query for /// semantic information. @@ -189,7 +185,7 @@ impl AnalysisHost { /// `Analysis` are canceled (most method return `Err(Canceled)`). #[derive(Debug)] pub struct Analysis { - db: salsa::Snapshot, + db: salsa::Snapshot, } // As a general design guideline, `Analysis` API are intended to be independent @@ -470,7 +466,7 @@ impl Analysis { } /// Performs an operation on that may be Canceled. - fn with_db T + std::panic::UnwindSafe, T>( + fn with_db T + std::panic::UnwindSafe, T>( &self, f: F, ) -> Cancelable { diff --git a/crates/ra_ide/src/parent_module.rs b/crates/ra_ide/src/parent_module.rs index 2dbccfc3b..e0332da88 100644 --- a/crates/ra_ide/src/parent_module.rs +++ b/crates/ra_ide/src/parent_module.rs @@ -1,12 +1,13 @@ //! FIXME: write short doc here use ra_db::{CrateId, FileId, FilePosition, SourceDatabase}; +use ra_ide_db::RootDatabase; use ra_syntax::{ algo::find_node_at_offset, ast::{self, AstNode}, }; -use crate::{db::RootDatabase, NavigationTarget}; +use crate::NavigationTarget; /// This returns `Vec` because a module may be included from several places. We /// don't handle this case yet though, so the Vec has length at most one. diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index ebded715d..b47f8bcd9 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -17,6 +17,7 @@ mod search_scope; use hir::{InFile, SourceBinder}; use once_cell::unsync::Lazy; use ra_db::{SourceDatabase, SourceDatabaseExt}; +use ra_ide_db::RootDatabase; use ra_prof::profile; use ra_syntax::{ algo::find_node_at_offset, @@ -24,9 +25,7 @@ use ra_syntax::{ match_ast, AstNode, SourceFile, SyntaxKind, SyntaxNode, TextRange, TextUnit, TokenAtOffset, }; -use crate::{ - db::RootDatabase, display::ToNav, FilePosition, FileRange, NavigationTarget, RangeInfo, -}; +use crate::{display::ToNav, FilePosition, FileRange, NavigationTarget, RangeInfo}; pub(crate) use self::{ classify::{classify_name, classify_name_ref}, diff --git a/crates/ra_ide/src/references/classify.rs b/crates/ra_ide/src/references/classify.rs index 46cba30a3..758ea4e8b 100644 --- a/crates/ra_ide/src/references/classify.rs +++ b/crates/ra_ide/src/references/classify.rs @@ -9,7 +9,7 @@ use super::{ name_definition::{from_assoc_item, from_module_def, from_struct_field}, NameDefinition, NameKind, }; -use crate::db::RootDatabase; +use ra_ide_db::RootDatabase; pub(crate) fn classify_name( sb: &mut SourceBinder, diff --git a/crates/ra_ide/src/references/name_definition.rs b/crates/ra_ide/src/references/name_definition.rs index 1e4226ab9..71565e6d3 100644 --- a/crates/ra_ide/src/references/name_definition.rs +++ b/crates/ra_ide/src/references/name_definition.rs @@ -9,7 +9,7 @@ use hir::{ }; use ra_syntax::{ast, ast::VisibilityOwner}; -use crate::db::RootDatabase; +use ra_ide_db::RootDatabase; #[derive(Debug, PartialEq, Eq)] pub enum NameKind { diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 9a84c1c88..08e77c01f 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs @@ -2,14 +2,14 @@ use hir::ModuleSource; use ra_db::{RelativePath, RelativePathBuf, SourceDatabase, SourceDatabaseExt}; +use ra_ide_db::RootDatabase; use ra_syntax::{ algo::find_node_at_offset, ast, lex_single_valid_syntax_kind, AstNode, SyntaxKind, SyntaxNode, }; use ra_text_edit::TextEdit; use crate::{ - db::RootDatabase, FileId, FilePosition, FileSystemEdit, RangeInfo, SourceChange, - SourceFileEdit, TextRange, + FileId, FilePosition, FileSystemEdit, RangeInfo, SourceChange, SourceFileEdit, TextRange, }; use super::find_all_refs; diff --git a/crates/ra_ide/src/references/search_scope.rs b/crates/ra_ide/src/references/search_scope.rs index f8211a746..97c65c2cd 100644 --- a/crates/ra_ide/src/references/search_scope.rs +++ b/crates/ra_ide/src/references/search_scope.rs @@ -10,7 +10,7 @@ use ra_prof::profile; use ra_syntax::{AstNode, TextRange}; use rustc_hash::FxHashMap; -use crate::db::RootDatabase; +use ra_ide_db::RootDatabase; use super::{NameDefinition, NameKind}; diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs index 8622dd956..b6b0c70f9 100644 --- a/crates/ra_ide/src/runnables.rs +++ b/crates/ra_ide/src/runnables.rs @@ -3,12 +3,13 @@ use hir::InFile; use itertools::Itertools; use ra_db::SourceDatabase; +use ra_ide_db::RootDatabase; use ra_syntax::{ ast::{self, AstNode, AttrsOwner, ModuleItemOwner, NameOwner}, match_ast, SyntaxNode, TextRange, }; -use crate::{db::RootDatabase, FileId}; +use crate::FileId; #[derive(Debug)] pub struct Runnable { diff --git a/crates/ra_ide/src/status.rs b/crates/ra_ide/src/status.rs index 538312086..30eb5c995 100644 --- a/crates/ra_ide/src/status.rs +++ b/crates/ra_ide/src/status.rs @@ -10,14 +10,14 @@ use ra_db::{ }, FileTextQuery, SourceRootId, }; +use ra_ide_db::{ + symbol_index::{LibrarySymbolsQuery, SymbolIndex}, + RootDatabase, +}; use ra_prof::{memory_usage, Bytes}; use ra_syntax::{ast, Parse, SyntaxNode}; -use crate::{ - db::RootDatabase, - ide_db::symbol_index::{LibrarySymbolsQuery, SymbolIndex}, - FileId, -}; +use crate::FileId; fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { db.query(ra_db::ParseQuery).entries::() diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 530b984fc..c5d249fe8 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -4,6 +4,7 @@ use rustc_hash::FxHashMap; use hir::{HirFileId, InFile, Name, SourceAnalyzer, SourceBinder}; use ra_db::SourceDatabase; +use ra_ide_db::RootDatabase; use ra_prof::profile; use ra_syntax::{ ast, AstNode, Direction, SyntaxElement, SyntaxKind, SyntaxKind::*, SyntaxToken, TextRange, @@ -11,7 +12,6 @@ use ra_syntax::{ }; use crate::{ - db::RootDatabase, expand::descend_into_macros_with_analyzer, references::{ classify_name, classify_name_ref, diff --git a/crates/ra_ide/src/syntax_tree.rs b/crates/ra_ide/src/syntax_tree.rs index 4d0f0fc47..55966daf3 100644 --- a/crates/ra_ide/src/syntax_tree.rs +++ b/crates/ra_ide/src/syntax_tree.rs @@ -1,7 +1,7 @@ //! FIXME: write short doc here -use crate::db::RootDatabase; use ra_db::SourceDatabase; +use ra_ide_db::RootDatabase; use ra_syntax::{ algo, AstNode, NodeOrToken, SourceFile, SyntaxKind::{RAW_STRING, STRING}, diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs index 21e5be9b3..e5d1779fd 100644 --- a/crates/ra_ide/src/typing.rs +++ b/crates/ra_ide/src/typing.rs @@ -15,6 +15,7 @@ use ra_db::{FilePosition, SourceDatabase}; use ra_fmt::leading_indent; +use ra_ide_db::RootDatabase; use ra_syntax::{ algo::find_node_at_offset, ast::{self, AstToken}, @@ -24,7 +25,7 @@ use ra_syntax::{ }; use ra_text_edit::TextEdit; -use crate::{db::RootDatabase, source_change::SingleFileChange, SourceChange, SourceFileEdit}; +use crate::{source_change::SingleFileChange, SourceChange, SourceFileEdit}; pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option { let parse = db.parse(position.file_id); -- cgit v1.2.3