mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Auto merge of #117772 - surechen:for_117448, r=petrochenkov
Tracking import use types for more accurate redundant import checking fixes #117448 By tracking import use types to check whether it is scope uses or the other situations like module-relative uses, we can do more accurate redundant import checking. For example unnecessary imports in std::prelude that can be eliminated: ```rust use std::option::Option::Some;//~ WARNING the item `Some` is imported redundantly use std::option::Option::None; //~ WARNING the item `None` is imported redundantly ```
This commit is contained in:
commit
1c10aa4735
19 changed files with 20 additions and 34 deletions
|
@ -6,7 +6,7 @@ use itertools::Itertools;
|
|||
|
||||
use crate::{
|
||||
hir::{
|
||||
Array, BindingAnnotation, BindingId, CaptureBy, ClosureKind, Literal, LiteralOrConst,
|
||||
Array, BindingAnnotation, CaptureBy, ClosureKind, Literal, LiteralOrConst,
|
||||
Movability, Statement,
|
||||
},
|
||||
pretty::{print_generic_args, print_path, print_type_ref},
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use std::{fmt, hash::BuildHasherDefault};
|
||||
|
||||
use base_db::CrateId;
|
||||
use fst::{self, raw::IndexedValue, Automaton, Streamer};
|
||||
use fst::{raw::IndexedValue, Automaton, Streamer};
|
||||
use hir_expand::name::Name;
|
||||
use indexmap::IndexMap;
|
||||
use itertools::Itertools;
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
use std::collections::hash_map::Entry;
|
||||
|
||||
use hir_expand::{ast_id_map::AstIdMap, span_map::SpanMapRef, HirFileId};
|
||||
use syntax::ast::{self, HasModuleItem, HasTypeBounds, IsString};
|
||||
use hir_expand::{ast_id_map::AstIdMap, span_map::SpanMapRef};
|
||||
use syntax::ast::{HasModuleItem, HasTypeBounds, IsString};
|
||||
|
||||
use crate::{
|
||||
generics::{GenericParams, GenericParamsCollector, TypeParamData, TypeParamProvenance},
|
||||
type_ref::{LifetimeRef, TraitBoundModifier, TraitRef},
|
||||
generics::{GenericParamsCollector, TypeParamData, TypeParamProvenance},
|
||||
type_ref::{LifetimeRef, TraitBoundModifier},
|
||||
LocalLifetimeParamId, LocalTypeOrConstParamId,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
//! `ItemTree` debug printer.
|
||||
|
||||
use std::fmt::{self, Write};
|
||||
use std::fmt::Write;
|
||||
|
||||
use span::ErasedFileAstId;
|
||||
|
||||
use crate::{
|
||||
generics::{TypeOrConstParamData, WherePredicate, WherePredicateTypeTarget},
|
||||
generics::{WherePredicate, WherePredicateTypeTarget},
|
||||
pretty::{print_path, print_type_bounds, print_type_ref},
|
||||
visibility::RawVisibility,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
|
|
|
@ -57,7 +57,7 @@ pub mod proc_macro;
|
|||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use std::{cmp::Ord, ops::Deref};
|
||||
use std::ops::Deref;
|
||||
|
||||
use base_db::{CrateId, Edition, FileId};
|
||||
use hir_expand::{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue