mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +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
|
@ -2,7 +2,7 @@
|
|||
//!
|
||||
//! Originates from `rustc_hir::pat_util`
|
||||
|
||||
use std::iter::{Enumerate, ExactSizeIterator};
|
||||
use std::iter::Enumerate;
|
||||
|
||||
pub(crate) struct EnumerateAndAdjust<I> {
|
||||
enumerate: Enumerate<I>,
|
||||
|
|
|
@ -4,11 +4,7 @@
|
|||
use std::cmp;
|
||||
|
||||
use chalk_ir::TyKind;
|
||||
use hir_def::{
|
||||
builtin_type::{BuiltinInt, BuiltinUint},
|
||||
resolver::HasResolver,
|
||||
};
|
||||
use hir_expand::mod_path::ModPath;
|
||||
use hir_def::builtin_type::{BuiltinInt, BuiltinUint};
|
||||
|
||||
use super::*;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! This module generates a polymorphic MIR from a hir body
|
||||
|
||||
use std::{fmt::Write, iter, mem};
|
||||
use std::{fmt::Write, mem};
|
||||
|
||||
use base_db::{salsa::Cycle, FileId};
|
||||
use chalk_ir::{BoundVar, ConstData, DebruijnIndex, TyKind};
|
||||
|
@ -14,23 +14,19 @@ use hir_def::{
|
|||
lang_item::{LangItem, LangItemTarget},
|
||||
path::Path,
|
||||
resolver::{resolver_for_expr, HasResolver, ResolveValueResult, ValueNs},
|
||||
AdtId, DefWithBodyId, EnumVariantId, GeneralConstId, HasModule, ItemContainerId, LocalFieldId,
|
||||
AdtId, EnumVariantId, GeneralConstId, HasModule, ItemContainerId, LocalFieldId,
|
||||
Lookup, TraitId, TupleId, TypeOrConstParamId,
|
||||
};
|
||||
use hir_expand::name::Name;
|
||||
use la_arena::ArenaMap;
|
||||
use rustc_hash::FxHashMap;
|
||||
use syntax::TextRange;
|
||||
use triomphe::Arc;
|
||||
|
||||
use crate::{
|
||||
consteval::ConstEvalError,
|
||||
db::{HirDatabase, InternedClosure},
|
||||
display::HirDisplay,
|
||||
db::InternedClosure,
|
||||
infer::{CaptureKind, CapturedItem, TypeMismatch},
|
||||
inhabitedness::is_ty_uninhabited_from,
|
||||
layout::LayoutError,
|
||||
mapping::ToChalk,
|
||||
static_lifetime,
|
||||
traits::FnTrait,
|
||||
utils::{generics, ClosureSubst},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! MIR lowering for patterns
|
||||
|
||||
use hir_def::{hir::LiteralOrConst, resolver::HasResolver, AssocItemId};
|
||||
use hir_def::AssocItemId;
|
||||
|
||||
use crate::BindingMode;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue