mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Cleanup ide_db imports
This commit is contained in:
parent
77a447dcda
commit
1ef55002c2
8 changed files with 15 additions and 10 deletions
|
@ -1,8 +1,9 @@
|
||||||
use crate::RootDatabase;
|
|
||||||
use base_db::{fixture::ChangeFixture, FilePosition};
|
use base_db::{fixture::ChangeFixture, FilePosition};
|
||||||
use expect_test::{expect, Expect};
|
use expect_test::{expect, Expect};
|
||||||
use test_utils::RangeOrOffset;
|
use test_utils::RangeOrOffset;
|
||||||
|
|
||||||
|
use crate::RootDatabase;
|
||||||
|
|
||||||
/// Creates analysis from a multi-file fixture, returns positions marked with $0.
|
/// Creates analysis from a multi-file fixture, returns positions marked with $0.
|
||||||
pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) {
|
pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) {
|
||||||
let change_fixture = ChangeFixture::parse(ra_fixture);
|
let change_fixture = ChangeFixture::parse(ra_fixture);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! Handle syntactic aspects of inserting a new `use`.
|
//! Handle syntactic aspects of inserting a new `use`.
|
||||||
use std::{cmp::Ordering, iter::successors};
|
use std::{cmp::Ordering, iter::successors};
|
||||||
|
|
||||||
use crate::RootDatabase;
|
|
||||||
use hir::Semantics;
|
use hir::Semantics;
|
||||||
use itertools::{EitherOrBoth, Itertools};
|
use itertools::{EitherOrBoth, Itertools};
|
||||||
use syntax::{
|
use syntax::{
|
||||||
|
@ -14,6 +13,8 @@ use syntax::{
|
||||||
AstToken, InsertPosition, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken,
|
AstToken, InsertPosition, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::RootDatabase;
|
||||||
|
|
||||||
pub use hir::PrefixKind;
|
pub use hir::PrefixKind;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! See `Label`
|
//! See [`Label`]
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// A type to specify UI label, like an entry in the list of assists. Enforces
|
/// A type to specify UI label, like an entry in the list of assists. Enforces
|
||||||
|
|
|
@ -12,9 +12,8 @@ use once_cell::unsync::Lazy;
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
use syntax::{ast, match_ast, AstNode, TextRange, TextSize};
|
use syntax::{ast, match_ast, AstNode, TextRange, TextSize};
|
||||||
|
|
||||||
use crate::defs::NameClass;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
defs::{Definition, NameRefClass},
|
defs::{Definition, NameClass, NameRefClass},
|
||||||
RootDatabase,
|
RootDatabase,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,8 @@ impl SourceChange {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Inserts a [`TextEdit`] for the given [`FileId`]. This properly handles merging existing
|
||||||
|
/// edits for a file if some already exist.
|
||||||
pub fn insert_source_edit(&mut self, file_id: FileId, edit: TextEdit) {
|
pub fn insert_source_edit(&mut self, file_id: FileId, edit: TextEdit) {
|
||||||
match self.source_file_edits.entry(file_id) {
|
match self.source_file_edits.entry(file_id) {
|
||||||
Entry::Occupied(mut entry) => {
|
Entry::Occupied(mut entry) => {
|
||||||
|
|
|
@ -61,7 +61,7 @@ pub fn get_missing_assoc_items(
|
||||||
resolve_target_trait(sema, impl_def).map_or(vec![], |target_trait| {
|
resolve_target_trait(sema, impl_def).map_or(vec![], |target_trait| {
|
||||||
target_trait
|
target_trait
|
||||||
.items(sema.db)
|
.items(sema.db)
|
||||||
.iter()
|
.into_iter()
|
||||||
.filter(|i| match i {
|
.filter(|i| match i {
|
||||||
hir::AssocItem::Function(f) => {
|
hir::AssocItem::Function(f) => {
|
||||||
!impl_fns_consts.contains(&f.name(sema.db).to_string())
|
!impl_fns_consts.contains(&f.name(sema.db).to_string())
|
||||||
|
@ -72,7 +72,6 @@ pub fn get_missing_assoc_items(
|
||||||
.map(|n| !impl_fns_consts.contains(&n.to_string()))
|
.map(|n| !impl_fns_consts.contains(&n.to_string()))
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
})
|
})
|
||||||
.cloned()
|
|
||||||
.collect()
|
.collect()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
use crate::RootDatabase;
|
|
||||||
use base_db::{fixture::ChangeFixture, FilePosition};
|
use base_db::{fixture::ChangeFixture, FilePosition};
|
||||||
use expect_test::{expect, Expect};
|
use expect_test::{expect, Expect};
|
||||||
use hir::Semantics;
|
use hir::Semantics;
|
||||||
use syntax::ast::{self, AstNode};
|
use syntax::ast::{self, AstNode};
|
||||||
use test_utils::RangeOrOffset;
|
use test_utils::RangeOrOffset;
|
||||||
|
|
||||||
|
use crate::RootDatabase;
|
||||||
|
|
||||||
/// Creates analysis from a multi-file fixture, returns positions marked with $0.
|
/// Creates analysis from a multi-file fixture, returns positions marked with $0.
|
||||||
pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) {
|
pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) {
|
||||||
let change_fixture = ChangeFixture::parse(ra_fixture);
|
let change_fixture = ChangeFixture::parse(ra_fixture);
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
//! Use case for structures in this module is, for example, situation when you need to process
|
//! Use case for structures in this module is, for example, situation when you need to process
|
||||||
//! only certain `Enum`s.
|
//! only certain `Enum`s.
|
||||||
|
|
||||||
use crate::RootDatabase;
|
|
||||||
use hir::{Adt, Semantics, Type};
|
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
|
use hir::{Adt, Semantics, Type};
|
||||||
use syntax::ast::{self, make};
|
use syntax::ast::{self, make};
|
||||||
|
|
||||||
|
use crate::RootDatabase;
|
||||||
|
|
||||||
/// Enum types that implement `std::ops::Try` trait.
|
/// Enum types that implement `std::ops::Try` trait.
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub enum TryEnum {
|
pub enum TryEnum {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue