Skip to content

Commit 9aa142b

Browse files
committed
Fix clippy build
1 parent 30a3673 commit 9aa142b

31 files changed

+71
-62
lines changed

src/tools/clippy/clippy_lints/src/blocks_in_if_conditions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clippy_utils::ty::implements_trait;
66
use if_chain::if_chain;
77
use rustc_errors::Applicability;
88
use rustc_hir::intravisit::{walk_expr, Visitor};
9-
use rustc_hir::{BlockCheckMode, Expr, ExprKind};
9+
use rustc_hir::{BlockCheckMode, Closure, Expr, ExprKind};
1010
use rustc_lint::{LateContext, LateLintPass, LintContext};
1111
use rustc_middle::lint::in_external_macro;
1212
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -51,7 +51,7 @@ struct ExVisitor<'a, 'tcx> {
5151

5252
impl<'a, 'tcx> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
5353
fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) {
54-
if let ExprKind::Closure { body, .. } = expr.kind {
54+
if let ExprKind::Closure(&Closure { body, .. }) = expr.kind {
5555
// do not lint if the closure is called using an iterator (see #1141)
5656
if_chain! {
5757
if let Some(parent) = get_parent_expr(self.cx, expr);

src/tools/clippy/clippy_lints/src/bytecount.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use clippy_utils::visitors::is_local_used;
55
use clippy_utils::{path_to_local_id, paths, peel_blocks, peel_ref_operators, strip_pat_refs};
66
use if_chain::if_chain;
77
use rustc_errors::Applicability;
8-
use rustc_hir::{BinOpKind, Expr, ExprKind, PatKind};
8+
use rustc_hir::{BinOpKind, Closure, Expr, ExprKind, PatKind};
99
use rustc_lint::{LateContext, LateLintPass};
1010
use rustc_middle::ty::{self, UintTy};
1111
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -51,7 +51,7 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount {
5151
if count.ident.name == sym::count;
5252
if let ExprKind::MethodCall(filter, [filter_recv, filter_arg], _) = count_recv.kind;
5353
if filter.ident.name == sym!(filter);
54-
if let ExprKind::Closure { body, .. } = filter_arg.kind;
54+
if let ExprKind::Closure(&Closure { body, .. }) = filter_arg.kind;
5555
let body = cx.tcx.hir().body(body);
5656
if let [param] = body.params;
5757
if let PatKind::Binding(_, arg_id, _, _) = strip_pat_refs(param.pat).kind;

src/tools/clippy/clippy_lints/src/eta_reduction.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use clippy_utils::{higher, is_adjusted, path_to_local, path_to_local_id};
77
use if_chain::if_chain;
88
use rustc_errors::Applicability;
99
use rustc_hir::def_id::DefId;
10-
use rustc_hir::{Expr, ExprKind, Param, PatKind, Unsafety};
10+
use rustc_hir::{Closure, Expr, ExprKind, Param, PatKind, Unsafety};
1111
use rustc_lint::{LateContext, LateLintPass};
1212
use rustc_middle::ty::adjustment::{Adjust, Adjustment, AutoBorrow};
1313
use rustc_middle::ty::binding::BindingMode;
@@ -78,7 +78,7 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
7878
return;
7979
}
8080
let body = match expr.kind {
81-
ExprKind::Closure { body, .. } => cx.tcx.hir().body(body),
81+
ExprKind::Closure(&Closure { body, .. }) => cx.tcx.hir().body(body),
8282
_ => return,
8383
};
8484
if body.value.span.from_expansion() {

src/tools/clippy/clippy_lints/src/infinite_iter.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint;
22
use clippy_utils::ty::{implements_trait, is_type_diagnostic_item};
33
use clippy_utils::{higher, match_def_path, path_def_id, paths};
4-
use rustc_hir::{BorrowKind, Expr, ExprKind};
4+
use rustc_hir::{BorrowKind, Closure, Expr, ExprKind};
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_session::{declare_lint_pass, declare_tool_lint};
77
use rustc_span::symbol::{sym, Symbol};
@@ -159,7 +159,7 @@ fn is_infinite(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness {
159159
}
160160
}
161161
if method.ident.name == sym!(flat_map) && args.len() == 2 {
162-
if let ExprKind::Closure { body, .. } = args[1].kind {
162+
if let ExprKind::Closure(&Closure { body, .. }) = args[1].kind {
163163
let body = cx.tcx.hir().body(body);
164164
return is_infinite(cx, &body.value);
165165
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_ast::ast;
99
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1010
use rustc_hir::def::{DefKind, Res};
1111
use rustc_hir::intravisit::{walk_expr, Visitor};
12-
use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, HirId, Mutability, Pat, PatKind, QPath};
12+
use rustc_hir::{BinOpKind, BorrowKind, Closure, Expr, ExprKind, HirId, Mutability, Pat, PatKind, QPath};
1313
use rustc_lint::LateContext;
1414
use rustc_middle::middle::region;
1515
use rustc_middle::ty::{self, Ty};
@@ -369,7 +369,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
369369
self.visit_expr(expr);
370370
}
371371
},
372-
ExprKind::Closure { body, .. } => {
372+
ExprKind::Closure(&Closure { body, .. }) => {
373373
let body = self.cx.tcx.hir().body(body);
374374
self.visit_expr(&body.value);
375375
},

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use clippy_utils::{
88
use if_chain::if_chain;
99
use rustc_errors::Applicability;
1010
use rustc_hir::intravisit::{walk_expr, Visitor};
11-
use rustc_hir::{def::Res, Expr, ExprKind, HirId, Local, Mutability, PatKind, QPath, UnOp};
11+
use rustc_hir::{Closure, def::Res, Expr, ExprKind, HirId, Local, Mutability, PatKind, QPath, UnOp};
1212
use rustc_lint::LateContext;
1313
use rustc_middle::ty::adjustment::Adjust;
1414
use rustc_span::{symbol::sym, Symbol};
@@ -220,7 +220,7 @@ fn uses_iter<'tcx>(cx: &LateContext<'tcx>, iter_expr: &IterExpr, container: &'tc
220220
if let Some(e) = e {
221221
self.visit_expr(e);
222222
}
223-
} else if let ExprKind::Closure { body: id, .. } = e.kind {
223+
} else if let ExprKind::Closure(&Closure { body: id, .. }) = e.kind {
224224
if is_res_used(self.cx, self.iter_expr.path, id) {
225225
self.uses_iter = true;
226226
}
@@ -260,7 +260,7 @@ fn needs_mutable_borrow(cx: &LateContext<'_>, iter_expr: &IterExpr, loop_expr: &
260260
if let Some(e) = e {
261261
self.visit_expr(e);
262262
}
263-
} else if let ExprKind::Closure { body: id, .. } = e.kind {
263+
} else if let ExprKind::Closure(&Closure { body: id, .. }) = e.kind {
264264
self.used_iter = is_res_used(self.cx, self.iter_expr.path, id);
265265
} else {
266266
walk_expr(self, e);
@@ -307,7 +307,7 @@ fn needs_mutable_borrow(cx: &LateContext<'_>, iter_expr: &IterExpr, loop_expr: &
307307
if let Some(e) = e {
308308
self.visit_expr(e);
309309
}
310-
} else if let ExprKind::Closure { body: id, .. } = e.kind {
310+
} else if let ExprKind::Closure(&Closure { body: id, .. }) = e.kind {
311311
self.used_after = is_res_used(self.cx, self.iter_expr.path, id);
312312
} else {
313313
walk_expr(self, e);

src/tools/clippy/clippy_lints/src/manual_async_fn.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use if_chain::if_chain;
66
use rustc_errors::Applicability;
77
use rustc_hir::intravisit::FnKind;
88
use rustc_hir::{
9-
AsyncGeneratorKind, Block, Body, Expr, ExprKind, FnDecl, FnRetTy, GeneratorKind, GenericArg, GenericBound, HirId,
9+
AsyncGeneratorKind, Block, Body, Closure, Expr, ExprKind, FnDecl, FnRetTy, GeneratorKind, GenericArg, GenericBound, HirId,
1010
IsAsync, ItemKind, LifetimeName, Term, TraitRef, Ty, TyKind, TypeBindingKind,
1111
};
1212
use rustc_lint::{LateContext, LateLintPass};
@@ -177,7 +177,7 @@ fn desugared_async_block<'tcx>(cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>)
177177
if let Some(block_expr) = block.expr;
178178
if let Some(args) = match_function_call(cx, block_expr, &FUTURE_FROM_GENERATOR);
179179
if args.len() == 1;
180-
if let Expr{kind: ExprKind::Closure { body, .. }, ..} = args[0];
180+
if let Expr{kind: ExprKind::Closure(&Closure { body, .. }), ..} = args[0];
181181
let closure_body = cx.tcx.hir().body(body);
182182
if closure_body.generator_kind == Some(GeneratorKind::Async(AsyncGeneratorKind::Block));
183183
then {

src/tools/clippy/clippy_lints/src/manual_ok_or.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use clippy_utils::{is_lang_ctor, path_to_local_id};
55
use if_chain::if_chain;
66
use rustc_errors::Applicability;
77
use rustc_hir::LangItem::{ResultErr, ResultOk};
8-
use rustc_hir::{Expr, ExprKind, PatKind};
8+
use rustc_hir::{Closure, Expr, ExprKind, PatKind};
99
use rustc_lint::LintContext;
1010
use rustc_lint::{LateContext, LateLintPass};
1111
use rustc_middle::lint::in_external_macro;
@@ -88,7 +88,7 @@ fn is_ok_wrapping(cx: &LateContext<'_>, map_expr: &Expr<'_>) -> bool {
8888
}
8989
}
9090
if_chain! {
91-
if let ExprKind::Closure { body, .. } = map_expr.kind;
91+
if let ExprKind::Closure(&Closure { body, .. }) = map_expr.kind;
9292
let body = cx.tcx.hir().body(body);
9393
if let PatKind::Binding(_, param_id, ..) = body.params[0].pat.kind;
9494
if let ExprKind::Call(Expr { kind: ExprKind::Path(ok_path), .. }, &[ref ok_arg]) = body.value.kind;

src/tools/clippy/clippy_lints/src/manual_retain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ fn check_to_owned(
148148

149149
fn suggest(cx: &LateContext<'_>, parent_expr: &hir::Expr<'_>, left_expr: &hir::Expr<'_>, filter_expr: &hir::Expr<'_>) {
150150
if let hir::ExprKind::MethodCall(_, [_, closure], _) = filter_expr.kind
151-
&& let hir::ExprKind::Closure{ body, ..} = closure.kind
151+
&& let hir::ExprKind::Closure(&hir::Closure { body, ..}) = closure.kind
152152
&& let filter_body = cx.tcx.hir().body(body)
153153
&& let [filter_params] = filter_body.params
154154
&& let Some(sugg) = match filter_params.pat.kind {

src/tools/clippy/clippy_lints/src/map_clone.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<'tcx> LateLintPass<'tcx> for MapClone {
6767
if method.ident.name == sym::map;
6868
let ty = cx.typeck_results().expr_ty(&args[0]);
6969
if is_type_diagnostic_item(cx, ty, sym::Option) || is_trait_method(cx, e, sym::Iterator);
70-
if let hir::ExprKind::Closure { body, .. } = args[1].kind;
70+
if let hir::ExprKind::Closure(&hir::Closure { body, .. }) = args[1].kind;
7171
then {
7272
let closure_body = cx.tcx.hir().body(body);
7373
let closure_expr = peel_blocks(&closure_body.value);

src/tools/clippy/clippy_lints/src/map_err_ignore.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use clippy_utils::diagnostics::span_lint_and_help;
2-
use rustc_hir::{CaptureBy, Expr, ExprKind, PatKind};
2+
use rustc_hir::{CaptureBy, Closure, Expr, ExprKind, PatKind};
33
use rustc_lint::{LateContext, LateLintPass};
44
use rustc_session::{declare_lint_pass, declare_tool_lint};
55

@@ -119,12 +119,12 @@ impl<'tcx> LateLintPass<'tcx> for MapErrIgnore {
119119
if method.ident.as_str() == "map_err" && args.len() == 2 {
120120
// make sure the first argument is a closure, and grab the CaptureRef, BodyId, and fn_decl_span
121121
// fields
122-
if let ExprKind::Closure {
122+
if let ExprKind::Closure(&Closure {
123123
capture_clause,
124124
body,
125125
fn_decl_span,
126126
..
127-
} = args[1].kind
127+
}) = args[1].kind
128128
{
129129
// check if this is by Reference (meaning there's no move statement)
130130
if capture_clause == CaptureBy::Ref {

src/tools/clippy/clippy_lints/src/map_unit_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn unit_closure<'tcx>(
169169
expr: &hir::Expr<'_>,
170170
) -> Option<(&'tcx hir::Param<'tcx>, &'tcx hir::Expr<'tcx>)> {
171171
if_chain! {
172-
if let hir::ExprKind::Closure { fn_decl, body, .. } = expr.kind;
172+
if let hir::ExprKind::Closure(&hir::Closure { fn_decl, body, .. }) = expr.kind;
173173
let body = cx.tcx.hir().body(body);
174174
let body_expr = &body.value;
175175
if fn_decl.inputs.len() == 1;

src/tools/clippy/clippy_lints/src/methods/bind_instead_of_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub(crate) trait BindInsteadOfMap {
150150
}
151151

152152
match arg.kind {
153-
hir::ExprKind::Closure { body, fn_decl_span, .. } => {
153+
hir::ExprKind::Closure(&hir::Closure { body, fn_decl_span, .. }) => {
154154
let closure_body = cx.tcx.hir().body(body);
155155
let closure_expr = peel_blocks(&closure_body.value);
156156

src/tools/clippy/clippy_lints/src/methods/filter_map.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use if_chain::if_chain;
66
use rustc_errors::Applicability;
77
use rustc_hir as hir;
88
use rustc_hir::def::Res;
9-
use rustc_hir::{Expr, ExprKind, PatKind, PathSegment, QPath, UnOp};
9+
use rustc_hir::{Closure, Expr, ExprKind, PatKind, PathSegment, QPath, UnOp};
1010
use rustc_lint::LateContext;
1111
use rustc_span::source_map::Span;
1212
use rustc_span::symbol::{sym, Symbol};
@@ -22,8 +22,8 @@ fn is_method<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, method_name: Sy
2222
hir::ExprKind::Path(QPath::Resolved(_, segments)) => {
2323
segments.segments.last().unwrap().ident.name == method_name
2424
},
25-
hir::ExprKind::Closure { body, .. } => {
26-
let body = cx.tcx.hir().body(*body);
25+
hir::ExprKind::Closure(&hir::Closure { body, .. }) => {
26+
let body = cx.tcx.hir().body(body);
2727
let closure_expr = peel_blocks(&body.value);
2828
let arg_id = body.params[0].pat.hir_id;
2929
match closure_expr.kind {
@@ -106,7 +106,7 @@ pub(super) fn check<'tcx>(
106106
if is_trait_method(cx, map_recv, sym::Iterator);
107107

108108
// filter(|x| ...is_some())...
109-
if let ExprKind::Closure { body: filter_body_id, .. } = filter_arg.kind;
109+
if let ExprKind::Closure(&Closure { body: filter_body_id, .. }) = filter_arg.kind;
110110
let filter_body = cx.tcx.hir().body(filter_body_id);
111111
if let [filter_param] = filter_body.params;
112112
// optional ref pattern: `filter(|&x| ..)`
@@ -129,7 +129,7 @@ pub(super) fn check<'tcx>(
129129
if path.ident.name.as_str() == if is_result { "is_ok" } else { "is_some" };
130130

131131
// ...map(|x| ...unwrap())
132-
if let ExprKind::Closure { body: map_body_id, .. } = map_arg.kind;
132+
if let ExprKind::Closure(&Closure { body: map_body_id, .. }) = map_arg.kind;
133133
let map_body = cx.tcx.hir().body(map_body_id);
134134
if let [map_param] = map_body.params;
135135
if let PatKind::Binding(_, map_param_id, map_param_ident, None) = map_param.pat.kind;

src/tools/clippy/clippy_lints/src/methods/option_as_ref_deref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub(super) fn check<'tcx>(
5151
.map_or(false, |fun_def_id| {
5252
deref_aliases.iter().any(|path| match_def_path(cx, fun_def_id, path))
5353
}),
54-
hir::ExprKind::Closure { body, .. } => {
54+
hir::ExprKind::Closure(&hir::Closure { body, .. }) => {
5555
let closure_body = cx.tcx.hir().body(body);
5656
let closure_expr = peel_blocks(&closure_body.value);
5757

src/tools/clippy/clippy_lints/src/methods/option_map_or_none.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub(super) fn check<'tcx>(
7171
if is_option {
7272
let self_snippet = snippet(cx, recv.span, "..");
7373
if_chain! {
74-
if let hir::ExprKind::Closure { body, fn_decl_span, .. } = map_arg.kind;
74+
if let hir::ExprKind::Closure(&hir::Closure { body, fn_decl_span, .. }) = map_arg.kind;
7575
let arg_snippet = snippet(cx, fn_decl_span, "..");
7676
let body = cx.tcx.hir().body(body);
7777
if let Some((func, [arg_char])) = reduce_unit_expression(&body.value);

src/tools/clippy/clippy_lints/src/methods/search_is_some.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub(super) fn check<'tcx>(
4141
let mut applicability = Applicability::MachineApplicable;
4242
let any_search_snippet = if_chain! {
4343
if search_method == "find";
44-
if let hir::ExprKind::Closure { body, .. } = search_arg.kind;
44+
if let hir::ExprKind::Closure(&hir::Closure { body, .. }) = search_arg.kind;
4545
let closure_body = cx.tcx.hir().body(body);
4646
if let Some(closure_arg) = closure_body.params.get(0);
4747
then {

src/tools/clippy/clippy_lints/src/methods/unnecessary_filter_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, arg: &hir::Expr<
1818
return;
1919
}
2020

21-
if let hir::ExprKind::Closure { body, .. } = arg.kind {
21+
if let hir::ExprKind::Closure(&hir::Closure { body, .. }) = arg.kind {
2222
let body = cx.tcx.hir().body(body);
2323
let arg_id = body.params[0].pat.hir_id;
2424
let mutates_arg =

src/tools/clippy/clippy_lints/src/methods/unnecessary_fold.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub(super) fn check(
2929
) {
3030
if_chain! {
3131
// Extract the body of the closure passed to fold
32-
if let hir::ExprKind::Closure { body, .. } = acc.kind;
32+
if let hir::ExprKind::Closure(&hir::Closure { body, .. }) = acc.kind;
3333
let closure_body = cx.tcx.hir().body(body);
3434
let closure_expr = peel_blocks(&closure_body.value);
3535

src/tools/clippy/clippy_lints/src/methods/unnecessary_lazy_eval.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub(super) fn check<'tcx>(
2222
let is_result = is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(recv), sym::Result);
2323

2424
if is_option || is_result {
25-
if let hir::ExprKind::Closure { body, .. } = arg.kind {
25+
if let hir::ExprKind::Closure(&hir::Closure { body, .. }) = arg.kind {
2626
let body = cx.tcx.hir().body(body);
2727
let body_expr = &body.value;
2828

src/tools/clippy/clippy_lints/src/needless_for_each.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_errors::Applicability;
22
use rustc_hir::{
33
intravisit::{walk_expr, Visitor},
4-
Expr, ExprKind, Stmt, StmtKind,
4+
Closure, Expr, ExprKind, Stmt, StmtKind,
55
};
66
use rustc_lint::{LateContext, LateLintPass};
77
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -72,7 +72,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessForEach {
7272
if has_iter_method(cx, cx.typeck_results().expr_ty(iter_recv)).is_some();
7373
// Skip the lint if the body is not block because this is simpler than `for` loop.
7474
// e.g. `v.iter().for_each(f)` is simpler and clearer than using `for` loop.
75-
if let ExprKind::Closure { body, .. } = for_each_arg.kind;
75+
if let ExprKind::Closure(&Closure { body, .. }) = for_each_arg.kind;
7676
let body = cx.tcx.hir().body(body);
7777
if let ExprKind::Block(..) = body.value.kind;
7878
then {

src/tools/clippy/clippy_lints/src/only_used_in_recursion.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_hir::def_id::DefId;
1111
use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
1212
use rustc_hir::intravisit::{walk_expr, walk_stmt, FnKind, Visitor};
1313
use rustc_hir::{
14-
Arm, Block, Body, Expr, ExprKind, Guard, HirId, ImplicitSelfKind, Let, Local, Pat, PatKind, Path, PathSegment,
14+
Arm, Closure, Block, Body, Expr, ExprKind, Guard, HirId, ImplicitSelfKind, Let, Local, Pat, PatKind, Path, PathSegment,
1515
QPath, Stmt, StmtKind, TyKind, UnOp,
1616
};
1717
use rustc_lint::{LateContext, LateLintPass};
@@ -298,7 +298,7 @@ impl<'tcx> Visitor<'tcx> for SideEffectVisit<'tcx> {
298298
},
299299
ExprKind::Match(expr, arms, _) => self.visit_match(expr, arms),
300300
// since analysing the closure is not easy, just set all variables in it to side-effect
301-
ExprKind::Closure { body, .. } => {
301+
ExprKind::Closure(&Closure { body, .. }) => {
302302
let body = self.tcx.hir().body(body);
303303
self.visit_body(body);
304304
let vars = std::mem::take(&mut self.ret_vars);

src/tools/clippy/clippy_lints/src/redundant_closure_call.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl EarlyLintPass for RedundantClosureCall {
6969
if_chain! {
7070
if let ast::ExprKind::Call(ref paren, _) = expr.kind;
7171
if let ast::ExprKind::Paren(ref closure) = paren.kind;
72-
if let ast::ExprKind::Closure(_, _, _, ref decl, ref block, _) = closure.kind;
72+
if let ast::ExprKind::Closure(_, _, _, _, ref decl, ref block, _) = closure.kind;
7373
then {
7474
let mut visitor = ReturnVisitor::new();
7575
visitor.visit_expr(block);

src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ fn ident_difference_expr_with_base_location(
582582
| (Await(_), Await(_))
583583
| (Async(_, _, _), Async(_, _, _))
584584
| (Block(_, _), Block(_, _))
585-
| (Closure(_, _, _, _, _, _), Closure(_, _, _, _, _, _))
585+
| (Closure(_, _, _, _, _, _, _), Closure(_, _, _, _, _, _, _))
586586
| (Match(_, _), Match(_, _))
587587
| (Loop(_, _), Loop(_, _))
588588
| (ForLoop(_, _, _, _), ForLoop(_, _, _, _))

src/tools/clippy/clippy_lints/src/unit_return_expecting_ord.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use clippy_utils::diagnostics::{span_lint, span_lint_and_help};
22
use clippy_utils::{get_trait_def_id, paths};
33
use if_chain::if_chain;
44
use rustc_hir::def_id::DefId;
5-
use rustc_hir::{Expr, ExprKind, StmtKind};
5+
use rustc_hir::{Closure, Expr, ExprKind, StmtKind};
66
use rustc_lint::{LateContext, LateLintPass};
77
use rustc_middle::ty;
88
use rustc_middle::ty::{GenericPredicates, PredicateKind, ProjectionPredicate, TraitPredicate};
@@ -116,7 +116,7 @@ fn get_args_to_check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Ve
116116

117117
fn check_arg<'tcx>(cx: &LateContext<'tcx>, arg: &'tcx Expr<'tcx>) -> Option<(Span, Option<Span>)> {
118118
if_chain! {
119-
if let ExprKind::Closure { body, fn_decl_span, .. } = arg.kind;
119+
if let ExprKind::Closure(&Closure { body, fn_decl_span, .. }) = arg.kind;
120120
if let ty::Closure(_def_id, substs) = &cx.typeck_results().node_type(arg.hir_id).kind();
121121
let ret_ty = substs.as_closure().sig().output();
122122
let ty = cx.tcx.erase_late_bound_regions(ret_ty);

0 commit comments

Comments
 (0)