aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_db/src')
-rw-r--r--crates/ide_db/src/call_info/tests.rs3
-rw-r--r--crates/ide_db/src/helpers/insert_use.rs3
-rw-r--r--crates/ide_db/src/label.rs2
-rw-r--r--crates/ide_db/src/search.rs3
-rw-r--r--crates/ide_db/src/source_change.rs2
-rw-r--r--crates/ide_db/src/traits.rs3
-rw-r--r--crates/ide_db/src/traits/tests.rs3
-rw-r--r--crates/ide_db/src/ty_filter.rs6
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 @@
1use crate::RootDatabase;
2use base_db::{fixture::ChangeFixture, FilePosition}; 1use base_db::{fixture::ChangeFixture, FilePosition};
3use expect_test::{expect, Expect}; 2use expect_test::{expect, Expect};
4use test_utils::RangeOrOffset; 3use test_utils::RangeOrOffset;
5 4
5use 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.
7pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { 8pub(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`.
2use std::{cmp::Ordering, iter::successors}; 2use std::{cmp::Ordering, iter::successors};
3 3
4use crate::RootDatabase;
5use hir::Semantics; 4use hir::Semantics;
6use itertools::{EitherOrBoth, Itertools}; 5use itertools::{EitherOrBoth, Itertools};
7use syntax::{ 6use 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
16use crate::RootDatabase;
17
17pub use hir::PrefixKind; 18pub 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`]
2use std::fmt; 2use 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;
12use rustc_hash::FxHashMap; 12use rustc_hash::FxHashMap;
13use syntax::{ast, match_ast, AstNode, TextRange, TextSize}; 13use syntax::{ast, match_ast, AstNode, TextRange, TextSize};
14 14
15use crate::defs::NameClass;
16use crate::{ 15use 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 @@
1use crate::RootDatabase;
2use base_db::{fixture::ChangeFixture, FilePosition}; 1use base_db::{fixture::ChangeFixture, FilePosition};
3use expect_test::{expect, Expect}; 2use expect_test::{expect, Expect};
4use hir::Semantics; 3use hir::Semantics;
5use syntax::ast::{self, AstNode}; 4use syntax::ast::{self, AstNode};
6use test_utils::RangeOrOffset; 5use test_utils::RangeOrOffset;
7 6
7use 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.
9pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { 10pub(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
5use crate::RootDatabase;
6use hir::{Adt, Semantics, Type};
7use std::iter; 5use std::iter;
6
7use hir::{Adt, Semantics, Type};
8use syntax::ast::{self, make}; 8use syntax::ast::{self, make};
9 9
10use 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)]
12pub enum TryEnum { 14pub enum TryEnum {