diff options
author | Lukas Wirth <[email protected]> | 2021-03-27 20:51:00 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-03-27 20:51:00 +0000 |
commit | 1ef55002c2db4ca68df31306290b019c7fbfb4fb (patch) | |
tree | 222f7661669f96792b5b987aba0b26ce07efcf4a /crates/ide_db/src | |
parent | 77a447dcda82a9f0eb6e1f04bd4b1dd53a226c65 (diff) |
Cleanup ide_db imports
Diffstat (limited to 'crates/ide_db/src')
-rw-r--r-- | crates/ide_db/src/call_info/tests.rs | 3 | ||||
-rw-r--r-- | crates/ide_db/src/helpers/insert_use.rs | 3 | ||||
-rw-r--r-- | crates/ide_db/src/label.rs | 2 | ||||
-rw-r--r-- | crates/ide_db/src/search.rs | 3 | ||||
-rw-r--r-- | crates/ide_db/src/source_change.rs | 2 | ||||
-rw-r--r-- | crates/ide_db/src/traits.rs | 3 | ||||
-rw-r--r-- | crates/ide_db/src/traits/tests.rs | 3 | ||||
-rw-r--r-- | crates/ide_db/src/ty_filter.rs | 6 |
8 files changed, 15 insertions, 10 deletions
diff --git a/crates/ide_db/src/call_info/tests.rs b/crates/ide_db/src/call_info/tests.rs index 75ab3eb6e..281a081a3 100644 --- a/crates/ide_db/src/call_info/tests.rs +++ b/crates/ide_db/src/call_info/tests.rs | |||
@@ -1,8 +1,9 @@ | |||
1 | use crate::RootDatabase; | ||
2 | use base_db::{fixture::ChangeFixture, FilePosition}; | 1 | use base_db::{fixture::ChangeFixture, FilePosition}; |
3 | use expect_test::{expect, Expect}; | 2 | use expect_test::{expect, Expect}; |
4 | use test_utils::RangeOrOffset; | 3 | use test_utils::RangeOrOffset; |
5 | 4 | ||
5 | use crate::RootDatabase; | ||
6 | |||
6 | /// Creates analysis from a multi-file fixture, returns positions marked with $0. | 7 | /// Creates analysis from a multi-file fixture, returns positions marked with $0. |
7 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { | 8 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { |
8 | let change_fixture = ChangeFixture::parse(ra_fixture); | 9 | let change_fixture = ChangeFixture::parse(ra_fixture); |
diff --git a/crates/ide_db/src/helpers/insert_use.rs b/crates/ide_db/src/helpers/insert_use.rs index e681ced80..be3a22725 100644 --- a/crates/ide_db/src/helpers/insert_use.rs +++ b/crates/ide_db/src/helpers/insert_use.rs | |||
@@ -1,7 +1,6 @@ | |||
1 | //! Handle syntactic aspects of inserting a new `use`. | 1 | //! Handle syntactic aspects of inserting a new `use`. |
2 | use std::{cmp::Ordering, iter::successors}; | 2 | use std::{cmp::Ordering, iter::successors}; |
3 | 3 | ||
4 | use crate::RootDatabase; | ||
5 | use hir::Semantics; | 4 | use hir::Semantics; |
6 | use itertools::{EitherOrBoth, Itertools}; | 5 | use itertools::{EitherOrBoth, Itertools}; |
7 | use syntax::{ | 6 | use syntax::{ |
@@ -14,6 +13,8 @@ use syntax::{ | |||
14 | AstToken, InsertPosition, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken, | 13 | AstToken, InsertPosition, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken, |
15 | }; | 14 | }; |
16 | 15 | ||
16 | use crate::RootDatabase; | ||
17 | |||
17 | pub use hir::PrefixKind; | 18 | pub use hir::PrefixKind; |
18 | 19 | ||
19 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] | 20 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
diff --git a/crates/ide_db/src/label.rs b/crates/ide_db/src/label.rs index c0e89e72f..1f1e715c9 100644 --- a/crates/ide_db/src/label.rs +++ b/crates/ide_db/src/label.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | //! See `Label` | 1 | //! See [`Label`] |
2 | use std::fmt; | 2 | use std::fmt; |
3 | 3 | ||
4 | /// A type to specify UI label, like an entry in the list of assists. Enforces | 4 | /// A type to specify UI label, like an entry in the list of assists. Enforces |
diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs index 3634b2b26..b55e3851e 100644 --- a/crates/ide_db/src/search.rs +++ b/crates/ide_db/src/search.rs | |||
@@ -12,9 +12,8 @@ use once_cell::unsync::Lazy; | |||
12 | use rustc_hash::FxHashMap; | 12 | use rustc_hash::FxHashMap; |
13 | use syntax::{ast, match_ast, AstNode, TextRange, TextSize}; | 13 | use syntax::{ast, match_ast, AstNode, TextRange, TextSize}; |
14 | 14 | ||
15 | use crate::defs::NameClass; | ||
16 | use crate::{ | 15 | use crate::{ |
17 | defs::{Definition, NameRefClass}, | 16 | defs::{Definition, NameClass, NameRefClass}, |
18 | RootDatabase, | 17 | RootDatabase, |
19 | }; | 18 | }; |
20 | 19 | ||
diff --git a/crates/ide_db/src/source_change.rs b/crates/ide_db/src/source_change.rs index b36455d49..846530f78 100644 --- a/crates/ide_db/src/source_change.rs +++ b/crates/ide_db/src/source_change.rs | |||
@@ -37,6 +37,8 @@ impl SourceChange { | |||
37 | } | 37 | } |
38 | } | 38 | } |
39 | 39 | ||
40 | /// Inserts a [`TextEdit`] for the given [`FileId`]. This properly handles merging existing | ||
41 | /// edits for a file if some already exist. | ||
40 | pub fn insert_source_edit(&mut self, file_id: FileId, edit: TextEdit) { | 42 | pub fn insert_source_edit(&mut self, file_id: FileId, edit: TextEdit) { |
41 | match self.source_file_edits.entry(file_id) { | 43 | match self.source_file_edits.entry(file_id) { |
42 | Entry::Occupied(mut entry) => { | 44 | Entry::Occupied(mut entry) => { |
diff --git a/crates/ide_db/src/traits.rs b/crates/ide_db/src/traits.rs index 78a43f587..66ae81c73 100644 --- a/crates/ide_db/src/traits.rs +++ b/crates/ide_db/src/traits.rs | |||
@@ -61,7 +61,7 @@ pub fn get_missing_assoc_items( | |||
61 | resolve_target_trait(sema, impl_def).map_or(vec![], |target_trait| { | 61 | resolve_target_trait(sema, impl_def).map_or(vec![], |target_trait| { |
62 | target_trait | 62 | target_trait |
63 | .items(sema.db) | 63 | .items(sema.db) |
64 | .iter() | 64 | .into_iter() |
65 | .filter(|i| match i { | 65 | .filter(|i| match i { |
66 | hir::AssocItem::Function(f) => { | 66 | hir::AssocItem::Function(f) => { |
67 | !impl_fns_consts.contains(&f.name(sema.db).to_string()) | 67 | !impl_fns_consts.contains(&f.name(sema.db).to_string()) |
@@ -72,7 +72,6 @@ pub fn get_missing_assoc_items( | |||
72 | .map(|n| !impl_fns_consts.contains(&n.to_string())) | 72 | .map(|n| !impl_fns_consts.contains(&n.to_string())) |
73 | .unwrap_or_default(), | 73 | .unwrap_or_default(), |
74 | }) | 74 | }) |
75 | .cloned() | ||
76 | .collect() | 75 | .collect() |
77 | }) | 76 | }) |
78 | } | 77 | } |
diff --git a/crates/ide_db/src/traits/tests.rs b/crates/ide_db/src/traits/tests.rs index 84bb25505..2a5482024 100644 --- a/crates/ide_db/src/traits/tests.rs +++ b/crates/ide_db/src/traits/tests.rs | |||
@@ -1,10 +1,11 @@ | |||
1 | use crate::RootDatabase; | ||
2 | use base_db::{fixture::ChangeFixture, FilePosition}; | 1 | use base_db::{fixture::ChangeFixture, FilePosition}; |
3 | use expect_test::{expect, Expect}; | 2 | use expect_test::{expect, Expect}; |
4 | use hir::Semantics; | 3 | use hir::Semantics; |
5 | use syntax::ast::{self, AstNode}; | 4 | use syntax::ast::{self, AstNode}; |
6 | use test_utils::RangeOrOffset; | 5 | use test_utils::RangeOrOffset; |
7 | 6 | ||
7 | use crate::RootDatabase; | ||
8 | |||
8 | /// Creates analysis from a multi-file fixture, returns positions marked with $0. | 9 | /// Creates analysis from a multi-file fixture, returns positions marked with $0. |
9 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { | 10 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { |
10 | let change_fixture = ChangeFixture::parse(ra_fixture); | 11 | let change_fixture = ChangeFixture::parse(ra_fixture); |
diff --git a/crates/ide_db/src/ty_filter.rs b/crates/ide_db/src/ty_filter.rs index f8406851b..988ecd060 100644 --- a/crates/ide_db/src/ty_filter.rs +++ b/crates/ide_db/src/ty_filter.rs | |||
@@ -2,11 +2,13 @@ | |||
2 | //! Use case for structures in this module is, for example, situation when you need to process | 2 | //! Use case for structures in this module is, for example, situation when you need to process |
3 | //! only certain `Enum`s. | 3 | //! only certain `Enum`s. |
4 | 4 | ||
5 | use crate::RootDatabase; | ||
6 | use hir::{Adt, Semantics, Type}; | ||
7 | use std::iter; | 5 | use std::iter; |
6 | |||
7 | use hir::{Adt, Semantics, Type}; | ||
8 | use syntax::ast::{self, make}; | 8 | use syntax::ast::{self, make}; |
9 | 9 | ||
10 | use crate::RootDatabase; | ||
11 | |||
10 | /// Enum types that implement `std::ops::Try` trait. | 12 | /// Enum types that implement `std::ops::Try` trait. |
11 | #[derive(Clone, Copy)] | 13 | #[derive(Clone, Copy)] |
12 | pub enum TryEnum { | 14 | pub enum TryEnum { |