mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Cleanup ide_db imports
This commit is contained in:
parent
77a447dcda
commit
1ef55002c2
@ -1,8 +1,9 @@
|
||||
use crate::RootDatabase;
|
||||
use base_db::{fixture::ChangeFixture, FilePosition};
|
||||
use expect_test::{expect, Expect};
|
||||
use test_utils::RangeOrOffset;
|
||||
|
||||
use crate::RootDatabase;
|
||||
|
||||
/// Creates analysis from a multi-file fixture, returns positions marked with $0.
|
||||
pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) {
|
||||
let change_fixture = ChangeFixture::parse(ra_fixture);
|
||||
|
@ -1,7 +1,6 @@
|
||||
//! Handle syntactic aspects of inserting a new `use`.
|
||||
use std::{cmp::Ordering, iter::successors};
|
||||
|
||||
use crate::RootDatabase;
|
||||
use hir::Semantics;
|
||||
use itertools::{EitherOrBoth, Itertools};
|
||||
use syntax::{
|
||||
@ -14,6 +13,8 @@ use syntax::{
|
||||
AstToken, InsertPosition, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken,
|
||||
};
|
||||
|
||||
use crate::RootDatabase;
|
||||
|
||||
pub use hir::PrefixKind;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
|
@ -1,4 +1,4 @@
|
||||
//! See `Label`
|
||||
//! See [`Label`]
|
||||
use std::fmt;
|
||||
|
||||
/// 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 syntax::{ast, match_ast, AstNode, TextRange, TextSize};
|
||||
|
||||
use crate::defs::NameClass;
|
||||
use crate::{
|
||||
defs::{Definition, NameRefClass},
|
||||
defs::{Definition, NameClass, NameRefClass},
|
||||
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) {
|
||||
match self.source_file_edits.entry(file_id) {
|
||||
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| {
|
||||
target_trait
|
||||
.items(sema.db)
|
||||
.iter()
|
||||
.into_iter()
|
||||
.filter(|i| match i {
|
||||
hir::AssocItem::Function(f) => {
|
||||
!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()))
|
||||
.unwrap_or_default(),
|
||||
})
|
||||
.cloned()
|
||||
.collect()
|
||||
})
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
use crate::RootDatabase;
|
||||
use base_db::{fixture::ChangeFixture, FilePosition};
|
||||
use expect_test::{expect, Expect};
|
||||
use hir::Semantics;
|
||||
use syntax::ast::{self, AstNode};
|
||||
use test_utils::RangeOrOffset;
|
||||
|
||||
use crate::RootDatabase;
|
||||
|
||||
/// Creates analysis from a multi-file fixture, returns positions marked with $0.
|
||||
pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) {
|
||||
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
|
||||
//! only certain `Enum`s.
|
||||
|
||||
use crate::RootDatabase;
|
||||
use hir::{Adt, Semantics, Type};
|
||||
use std::iter;
|
||||
|
||||
use hir::{Adt, Semantics, Type};
|
||||
use syntax::ast::{self, make};
|
||||
|
||||
use crate::RootDatabase;
|
||||
|
||||
/// Enum types that implement `std::ops::Try` trait.
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum TryEnum {
|
||||
|
Loading…
Reference in New Issue
Block a user