Skip to content

Commit

Permalink
remove redundant imports
Browse files Browse the repository at this point in the history
detects redundant imports that can be eliminated.

for rust-lang#117772 :

In order to facilitate review and modification, split the checking code and
removing redundant imports code into two PR.
  • Loading branch information
surechen committed Dec 10, 2023
1 parent 0252580 commit 0109fa6
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/escape.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clippy_utils::diagnostics::span_lint_hir;
use rustc_hir::{self, intravisit, AssocItemKind, Body, FnDecl, HirId, HirIdSet, Impl, ItemKind, Node, Pat, PatKind};
use rustc_hir::{intravisit, AssocItemKind, Body, FnDecl, HirId, HirIdSet, Impl, ItemKind, Node, Pat, PatKind};
use rustc_hir_typeck::expr_use_visitor::{Delegate, ExprUseVisitor, PlaceBase, PlaceWithHirId};
use rustc_infer::infer::TyCtxtInferExt;
use rustc_lint::{LateContext, LateLintPass};
Expand Down
1 change: 0 additions & 1 deletion clippy_lints/src/loops/manual_memcpy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use rustc_lint::LateContext;
use rustc_middle::ty::{self, Ty};
use rustc_span::symbol::sym;
use std::fmt::Display;
use std::iter::Iterator;

/// Checks for `for` loops that sequentially copy items from one slice-like
/// object to another.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/loops/needless_range_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rustc_lint::LateContext;
use rustc_middle::middle::region;
use rustc_middle::ty::{self, Ty};
use rustc_span::symbol::{sym, Symbol};
use std::iter::{self, Iterator};
use std::iter::{self};
use std::mem;

/// Checks for looping over a range and then indexing a sequence with it.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/loops/never_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use rustc_errors::Applicability;
use rustc_hir::{Block, Destination, Expr, ExprKind, HirId, InlineAsmOperand, Pat, Stmt, StmtKind};
use rustc_lint::LateContext;
use rustc_span::{sym, Span};
use std::iter::{once, Iterator};
use std::iter::once;

pub(super) fn check<'tcx>(
cx: &LateContext<'tcx>,
Expand Down
1 change: 0 additions & 1 deletion clippy_lints/src/loops/same_item_push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, HirId, Mutability, Nod
use rustc_lint::LateContext;
use rustc_span::symbol::sym;
use rustc_span::SyntaxContext;
use std::iter::Iterator;

/// Detects for loop pushing the same item into a Vec
pub(super) fn check<'tcx>(
Expand Down
1 change: 0 additions & 1 deletion clippy_lints/src/loops/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use rustc_middle::hir::nested_filter;
use rustc_middle::ty::{self, Ty};
use rustc_span::source_map::Spanned;
use rustc_span::symbol::{sym, Symbol};
use std::iter::Iterator;

#[derive(Debug, PartialEq, Eq)]
enum IncrementVisitorVarState {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/option_map_unwrap_or.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rustc_data_structures::fx::FxHashSet;
use rustc_errors::Applicability;
use rustc_hir::def::Res;
use rustc_hir::intravisit::{walk_path, Visitor};
use rustc_hir::{self, ExprKind, HirId, Node, PatKind, Path, QPath};
use rustc_hir::{ExprKind, HirId, Node, PatKind, Path, QPath};
use rustc_lint::LateContext;
use rustc_middle::hir::nested_filter;
use rustc_span::{sym, Span};
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/missing_inline.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clippy_utils::diagnostics::span_lint;
use rustc_ast::ast;
use rustc_hir as hir;
use rustc_lint::{self, LateContext, LateLintPass, LintContext};
use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_session::declare_lint_pass;
use rustc_span::{sym, Span};

Expand Down

0 comments on commit 0109fa6

Please sign in to comment.