Skip to content

Commit 88267c8

Browse files
committed
cleanup imports
1 parent 939f05f commit 88267c8

31 files changed

+103
-100
lines changed

crates/ra_ide/src/assists.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//! FIXME: write short doc here
22
3+
use either::Either;
4+
use ra_assists::{AssistAction, AssistLabel};
35
use ra_db::{FilePosition, FileRange};
6+
use ra_ide_db::RootDatabase;
7+
8+
use crate::{imports_locator::ImportsLocatorIde, FileId, SourceChange, SourceFileEdit};
49

5-
use crate::{
6-
db::RootDatabase, imports_locator::ImportsLocatorIde, FileId, SourceChange, SourceFileEdit,
7-
};
8-
use either::Either;
910
pub use ra_assists::AssistId;
10-
use ra_assists::{AssistAction, AssistLabel};
1111

1212
#[derive(Debug)]
1313
pub struct Assist {

crates/ra_ide/src/call_hierarchy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
use indexmap::IndexMap;
44

55
use hir::db::AstDatabase;
6+
use ra_ide_db::RootDatabase;
67
use ra_syntax::{
78
ast::{self, DocCommentsOwner},
89
match_ast, AstNode, TextRange,
910
};
1011

1112
use crate::{
1213
call_info::FnCallNode,
13-
db::RootDatabase,
1414
display::{ShortLabel, ToNav},
1515
expand::descend_into_macros,
1616
goto_definition, references, FilePosition, NavigationTarget, RangeInfo,

crates/ra_ide/src/call_info.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
//! FIXME: write short doc here
22
use hir::db::AstDatabase;
3+
use ra_ide_db::RootDatabase;
34
use ra_syntax::{
45
ast::{self, ArgListOwner},
56
match_ast, AstNode, SyntaxNode,
67
};
7-
88
use test_utils::tested_by;
99

10-
use crate::{
11-
db::RootDatabase, expand::descend_into_macros, CallInfo, FilePosition, FunctionSignature,
12-
};
10+
use crate::{expand::descend_into_macros, CallInfo, FilePosition, FunctionSignature};
1311

1412
/// Computes parameter information for the given call expression.
1513
pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<CallInfo> {

crates/ra_ide/src/completion.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ mod complete_postfix;
1717
mod complete_macro_in_item_position;
1818

1919
use ra_db::SourceDatabase;
20+
use ra_ide_db::RootDatabase;
2021

2122
#[cfg(test)]
2223
use crate::completion::completion_item::do_completion;
@@ -25,7 +26,7 @@ use crate::{
2526
completion_context::CompletionContext,
2627
completion_item::{CompletionKind, Completions},
2728
},
28-
db, FilePosition,
29+
FilePosition,
2930
};
3031

3132
pub use crate::completion::completion_item::{
@@ -54,7 +55,7 @@ pub use crate::completion::completion_item::{
5455
/// `foo` *should* be present among the completion variants. Filtering by
5556
/// identifier prefix/fuzzy match should be done higher in the stack, together
5657
/// with ordering of completions (currently this is done by the client).
57-
pub(crate) fn completions(db: &db::RootDatabase, position: FilePosition) -> Option<Completions> {
58+
pub(crate) fn completions(db: &RootDatabase, position: FilePosition) -> Option<Completions> {
5859
let original_parse = db.parse(position.file_id);
5960
let ctx = CompletionContext::new(db, &original_parse, position)?;
6061

crates/ra_ide/src/completion/completion_context.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! FIXME: write short doc here
22
3+
use ra_ide_db::RootDatabase;
34
use ra_syntax::{
45
algo::{find_covering_element, find_node_at_offset},
56
ast, AstNode, Parse, SourceFile,
@@ -8,13 +9,13 @@ use ra_syntax::{
89
};
910
use ra_text_edit::AtomTextEdit;
1011

11-
use crate::{db, FilePosition};
12+
use crate::FilePosition;
1213

1314
/// `CompletionContext` is created early during completion to figure out, where
1415
/// exactly is the cursor, syntax-wise.
1516
#[derive(Debug)]
1617
pub(crate) struct CompletionContext<'a> {
17-
pub(super) db: &'a db::RootDatabase,
18+
pub(super) db: &'a RootDatabase,
1819
pub(super) analyzer: hir::SourceAnalyzer,
1920
pub(super) offset: TextUnit,
2021
pub(super) token: SyntaxToken,
@@ -48,7 +49,7 @@ pub(crate) struct CompletionContext<'a> {
4849

4950
impl<'a> CompletionContext<'a> {
5051
pub(super) fn new(
51-
db: &'a db::RootDatabase,
52+
db: &'a RootDatabase,
5253
original_parse: &'a Parse<ast::SourceFile>,
5354
position: FilePosition,
5455
) -> Option<CompletionContext<'a>> {

crates/ra_ide/src/db.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/ra_ide/src/diagnostics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::cell::RefCell;
55
use hir::diagnostics::{AstDiagnostic, Diagnostic as _, DiagnosticSink};
66
use itertools::Itertools;
77
use ra_db::{RelativePath, SourceDatabase, SourceDatabaseExt};
8+
use ra_ide_db::RootDatabase;
89
use ra_prof::profile;
910
use ra_syntax::{
1011
algo,
@@ -13,7 +14,7 @@ use ra_syntax::{
1314
};
1415
use ra_text_edit::{TextEdit, TextEditBuilder};
1516

16-
use crate::{db::RootDatabase, Diagnostic, FileId, FileSystemEdit, SourceChange, SourceFileEdit};
17+
use crate::{Diagnostic, FileId, FileSystemEdit, SourceChange, SourceFileEdit};
1718

1819
#[derive(Debug, Copy, Clone)]
1920
pub enum Severity {

crates/ra_ide/src/display/function_signature.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ use std::fmt::{self, Display};
44

55
use hir::{Docs, Documentation, HasSource, HirDisplay};
66
use join_to_string::join;
7+
use ra_ide_db::RootDatabase;
78
use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner};
89
use std::convert::From;
910

10-
use crate::{
11-
db,
12-
display::{generic_parameters, where_predicates},
13-
};
11+
use crate::display::{generic_parameters, where_predicates};
1412

1513
#[derive(Debug)]
1614
pub enum CallableKind {
@@ -48,13 +46,13 @@ impl FunctionSignature {
4846
self
4947
}
5048

51-
pub(crate) fn from_hir(db: &db::RootDatabase, function: hir::Function) -> Self {
49+
pub(crate) fn from_hir(db: &RootDatabase, function: hir::Function) -> Self {
5250
let doc = function.docs(db);
5351
let ast_node = function.source(db).value;
5452
FunctionSignature::from(&ast_node).with_doc_opt(doc)
5553
}
5654

57-
pub(crate) fn from_struct(db: &db::RootDatabase, st: hir::Struct) -> Option<Self> {
55+
pub(crate) fn from_struct(db: &RootDatabase, st: hir::Struct) -> Option<Self> {
5856
let node: ast::StructDef = st.source(db).value;
5957
match node.kind() {
6058
ast::StructKind::Record(_) => return None,
@@ -86,10 +84,7 @@ impl FunctionSignature {
8684
)
8785
}
8886

89-
pub(crate) fn from_enum_variant(
90-
db: &db::RootDatabase,
91-
variant: hir::EnumVariant,
92-
) -> Option<Self> {
87+
pub(crate) fn from_enum_variant(db: &RootDatabase, variant: hir::EnumVariant) -> Option<Self> {
9388
let node: ast::EnumVariant = variant.source(db).value;
9489
match node.kind() {
9590
ast::StructKind::Record(_) | ast::StructKind::Unit => return None,
@@ -126,7 +121,7 @@ impl FunctionSignature {
126121
)
127122
}
128123

129-
pub(crate) fn from_macro(db: &db::RootDatabase, macro_def: hir::MacroDef) -> Option<Self> {
124+
pub(crate) fn from_macro(db: &RootDatabase, macro_def: hir::MacroDef) -> Option<Self> {
130125
let node: ast::MacroCall = macro_def.source(db).value;
131126

132127
let params = vec![];

crates/ra_ide/src/display/navigation_target.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
use either::Either;
44
use hir::{AssocItem, FieldSource, HasSource, InFile, ModuleSource};
55
use ra_db::{FileId, SourceDatabase};
6+
use ra_ide_db::RootDatabase;
67
use ra_syntax::{
78
ast::{self, DocCommentsOwner, NameOwner},
89
match_ast, AstNode, SmolStr,
910
SyntaxKind::{self, BIND_PAT, TYPE_PARAM},
1011
TextRange,
1112
};
1213

13-
use crate::{db::RootDatabase, expand::original_range, FileSymbol};
14+
use crate::{expand::original_range, FileSymbol};
1415

1516
use super::short_label::ShortLabel;
1617

crates/ra_ide/src/expand.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ use std::iter::successors;
33

44
use hir::{InFile, Origin};
55
use ra_db::FileId;
6+
use ra_ide_db::RootDatabase;
67
use ra_syntax::{ast, AstNode, SyntaxNode, SyntaxToken, TextRange};
78

8-
use crate::{db::RootDatabase, FileRange};
9+
use crate::FileRange;
910

1011
pub(crate) fn original_range(db: &RootDatabase, node: InFile<&SyntaxNode>) -> FileRange {
1112
if let Some((range, Origin::Call)) = original_range_and_origin(db, node) {

0 commit comments

Comments
 (0)