Swap for_each_expr and for_each_expr_with_closures
This commit is contained in:
parent
680256f3ce
commit
e6040437ef
34 changed files with 81 additions and 81 deletions
|
|
@ -3,7 +3,7 @@ use std::ops::ControlFlow;
|
|||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::is_path_lang_item;
|
||||
use clippy_utils::ty::is_type_diagnostic_item;
|
||||
use clippy_utils::visitors::{for_each_expr, Visitable};
|
||||
use clippy_utils::visitors::{for_each_expr_without_closures, Visitable};
|
||||
use rustc_ast::LitKind;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
|
|
@ -110,7 +110,7 @@ fn should_lint<'tcx>(
|
|||
// Is there a call to `DebugStruct::debug_struct`? Do lint if there is.
|
||||
let mut has_debug_struct = false;
|
||||
|
||||
for_each_expr(block, |expr| {
|
||||
for_each_expr_without_closures(block, |expr| {
|
||||
if let ExprKind::MethodCall(path, recv, ..) = &expr.kind {
|
||||
let recv_ty = typeck_results.expr_ty(recv).peel_refs();
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ fn check_struct<'tcx>(
|
|||
let mut has_direct_field_access = false;
|
||||
let mut field_accesses = FxHashSet::default();
|
||||
|
||||
for_each_expr(block, |expr| {
|
||||
for_each_expr_without_closures(block, |expr| {
|
||||
if let ExprKind::Field(target, ident) = expr.kind
|
||||
&& let target_ty = typeck_results.expr_ty_adjusted(target).peel_refs()
|
||||
&& target_ty == self_ty
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue