Skip to content

Commit c73a7f0

Browse files
committed
Remove unused structs in clippy
1 parent 1299aa7 commit c73a7f0

File tree

2 files changed

+2
-64
lines changed

2 files changed

+2
-64
lines changed

src/tools/clippy/clippy_lints/src/loops/utils.rs

+2-58
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use clippy_utils::ty::{has_iter_method, implements_trait};
22
use clippy_utils::{get_parent_expr, is_integer_const, path_to_local, path_to_local_id, sugg};
33
use rustc_ast::ast::{LitIntType, LitKind};
44
use rustc_errors::Applicability;
5-
use rustc_hir::intravisit::{walk_expr, walk_local, walk_pat, walk_stmt, Visitor};
6-
use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, HirId, HirIdMap, Local, Mutability, Pat, PatKind, Stmt};
5+
use rustc_hir::intravisit::{walk_expr, walk_local, Visitor};
6+
use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, HirId, HirIdMap, Local, Mutability, PatKind};
77
use rustc_lint::LateContext;
88
use rustc_middle::hir::nested_filter;
99
use rustc_middle::ty::{self, Ty};
@@ -253,62 +253,6 @@ fn is_conditional(expr: &Expr<'_>) -> bool {
253253
matches!(expr.kind, ExprKind::If(..) | ExprKind::Match(..))
254254
}
255255

256-
#[derive(PartialEq, Eq)]
257-
pub(super) enum Nesting {
258-
Unknown, // no nesting detected yet
259-
RuledOut, // the iterator is initialized or assigned within scope
260-
LookFurther, // no nesting detected, no further walk required
261-
}
262-
263-
use self::Nesting::{LookFurther, RuledOut, Unknown};
264-
265-
pub(super) struct LoopNestVisitor {
266-
pub(super) hir_id: HirId,
267-
pub(super) iterator: HirId,
268-
pub(super) nesting: Nesting,
269-
}
270-
271-
impl<'tcx> Visitor<'tcx> for LoopNestVisitor {
272-
fn visit_stmt(&mut self, stmt: &'tcx Stmt<'_>) {
273-
if stmt.hir_id == self.hir_id {
274-
self.nesting = LookFurther;
275-
} else if self.nesting == Unknown {
276-
walk_stmt(self, stmt);
277-
}
278-
}
279-
280-
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
281-
if self.nesting != Unknown {
282-
return;
283-
}
284-
if expr.hir_id == self.hir_id {
285-
self.nesting = LookFurther;
286-
return;
287-
}
288-
match expr.kind {
289-
ExprKind::Assign(path, _, _) | ExprKind::AssignOp(_, path, _) => {
290-
if path_to_local_id(path, self.iterator) {
291-
self.nesting = RuledOut;
292-
}
293-
},
294-
_ => walk_expr(self, expr),
295-
}
296-
}
297-
298-
fn visit_pat(&mut self, pat: &'tcx Pat<'_>) {
299-
if self.nesting != Unknown {
300-
return;
301-
}
302-
if let PatKind::Binding(_, id, ..) = pat.kind {
303-
if id == self.iterator {
304-
self.nesting = RuledOut;
305-
return;
306-
}
307-
}
308-
walk_pat(self, pat);
309-
}
310-
}
311-
312256
/// If `arg` was the argument to a `for` loop, return the "cleanest" way of writing the
313257
/// actual `Iterator` that the loop uses.
314258
pub(super) fn make_iterator_snippet(cx: &LateContext<'_>, arg: &Expr<'_>, applic_ref: &mut Applicability) -> String {

src/tools/clippy/clippy_lints/src/macro_use.rs

-6
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ declare_clippy_lint! {
3030
"#[macro_use] is no longer needed"
3131
}
3232

33-
#[derive(Clone, Debug, PartialEq, Eq)]
34-
struct PathAndSpan {
35-
path: String,
36-
span: Span,
37-
}
38-
3933
/// `MacroRefData` includes the name of the macro.
4034
#[derive(Debug, Clone)]
4135
pub struct MacroRefData {

0 commit comments

Comments
 (0)