Skip to content

Commit bd071bf

Browse files
authored
Rollup merge of rust-lang#98110 - cjgillot:closure-brace, r=Aaron1011
Make `ExprKind::Closure` a struct variant. Simple refactor since we both need it to introduce additional fields in `ExprKind::Closure`. r? ``@Aaron1011``
2 parents 196f3c0 + 7b84a97 commit bd071bf

36 files changed

+112
-98
lines changed

clippy_lints/src/blocks_in_if_conditions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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(_, _, eid, _, _) = expr.kind {
54+
if let ExprKind::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);
@@ -64,7 +64,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
6464
}
6565
}
6666

67-
let body = self.cx.tcx.hir().body(eid);
67+
let body = self.cx.tcx.hir().body(body);
6868
let ex = &body.value;
6969
if let ExprKind::Block(block, _) = ex.kind {
7070
if !body.value.span.from_expansion() && !block.stmts.is_empty() {

clippy_lints/src/bytecount.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ 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_id, _, _) = filter_arg.kind;
55-
let body = cx.tcx.hir().body(body_id);
54+
if let ExprKind::Closure { body, .. } = filter_arg.kind;
55+
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;
5858
if let ExprKind::Binary(ref op, l, r) = body.value.kind;

clippy_lints/src/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ fn is_linted_explicit_deref_position(parent: Option<Node<'_>>, child_id: HirId,
498498
| ExprKind::Loop(..)
499499
| ExprKind::Match(..)
500500
| ExprKind::Let(..)
501-
| ExprKind::Closure(..)
501+
| ExprKind::Closure{..}
502502
| ExprKind::Block(..)
503503
| ExprKind::Assign(..)
504504
| ExprKind::AssignOp(..)

clippy_lints/src/eta_reduction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
7878
return;
7979
}
8080
let body = match expr.kind {
81-
ExprKind::Closure(_, _, id, _, _) => cx.tcx.hir().body(id),
81+
ExprKind::Closure { body, .. } => cx.tcx.hir().body(body),
8282
_ => return,
8383
};
8484
if body.value.span.from_expansion() {

clippy_lints/src/infinite_iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ fn is_infinite(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness {
158158
}
159159
}
160160
if method.ident.name == sym!(flat_map) && args.len() == 2 {
161-
if let ExprKind::Closure(_, _, body_id, _, _) = args[1].kind {
162-
let body = cx.tcx.hir().body(body_id);
161+
if let ExprKind::Closure { body, .. } = args[1].kind {
162+
let body = cx.tcx.hir().body(body);
163163
return is_infinite(cx, &body.value);
164164
}
165165
}

clippy_lints/src/loops/needless_range_loop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
369369
self.visit_expr(expr);
370370
}
371371
},
372-
ExprKind::Closure(_, _, body_id, ..) => {
373-
let body = self.cx.tcx.hir().body(body_id);
372+
ExprKind::Closure { body, .. } => {
373+
let body = self.cx.tcx.hir().body(body);
374374
self.visit_expr(&body.value);
375375
},
376376
_ => walk_expr(self, expr),

clippy_lints/src/loops/never_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ fn never_loop_expr(expr: &Expr<'_>, main_loop_id: HirId) -> NeverLoopResult {
182182
.fold(NeverLoopResult::Otherwise, combine_both),
183183
ExprKind::Struct(_, _, None)
184184
| ExprKind::Yield(_, _)
185-
| ExprKind::Closure(_, _, _, _, _)
185+
| ExprKind::Closure { .. }
186186
| ExprKind::Path(_)
187187
| ExprKind::ConstBlock(_)
188188
| ExprKind::Lit(_)

clippy_lints/src/loops/while_let_on_iterator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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(_, _, id, _, _) = e.kind {
223+
} else if let ExprKind::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(_, _, id, _, _) = e.kind {
263+
} else if let ExprKind::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(_, _, id, _, _) = e.kind {
310+
} else if let ExprKind::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);

clippy_lints/src/manual_async_fn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ 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_id, ..), ..} = args[0];
181-
let closure_body = cx.tcx.hir().body(body_id);
180+
if let Expr{kind: ExprKind::Closure { body, .. }, ..} = args[0];
181+
let closure_body = cx.tcx.hir().body(body);
182182
if closure_body.generator_kind == Some(GeneratorKind::Async(AsyncGeneratorKind::Block));
183183
then {
184184
return Some(closure_body);

clippy_lints/src/manual_ok_or.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ fn is_ok_wrapping(cx: &LateContext<'_>, map_expr: &Expr<'_>) -> bool {
8888
}
8989
}
9090
if_chain! {
91-
if let ExprKind::Closure(_, _, body_id, ..) = map_expr.kind;
92-
let body = cx.tcx.hir().body(body_id);
91+
if let ExprKind::Closure { body, .. } = map_expr.kind;
92+
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;
9595
if is_lang_ctor(cx, ok_path, ResultOk);

clippy_lints/src/map_clone.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ 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_id, _, _) = args[1].kind;
70+
if let hir::ExprKind::Closure { body, .. } = args[1].kind;
7171
then {
72-
let closure_body = cx.tcx.hir().body(body_id);
72+
let closure_body = cx.tcx.hir().body(body);
7373
let closure_expr = peel_blocks(&closure_body.value);
7474
match closure_body.params[0].pat.kind {
7575
hir::PatKind::Ref(inner, hir::Mutability::Not) => if let hir::PatKind::Binding(

clippy_lints/src/map_err_ignore.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,19 @@ impl<'tcx> LateLintPass<'tcx> for MapErrIgnore {
117117
// only work if the method name is `map_err` and there are only 2 arguments (e.g. x.map_err(|_|[1]
118118
// Enum::Variant[2]))
119119
if method.ident.as_str() == "map_err" && args.len() == 2 {
120-
// make sure the first argument is a closure, and grab the CaptureRef, body_id, and body_span fields
121-
if let ExprKind::Closure(capture, _, body_id, body_span, _) = args[1].kind {
120+
// make sure the first argument is a closure, and grab the CaptureRef, BodyId, and fn_decl_span
121+
// fields
122+
if let ExprKind::Closure {
123+
capture_clause,
124+
body,
125+
fn_decl_span,
126+
..
127+
} = args[1].kind
128+
{
122129
// check if this is by Reference (meaning there's no move statement)
123-
if capture == CaptureBy::Ref {
130+
if capture_clause == CaptureBy::Ref {
124131
// Get the closure body to check the parameters and values
125-
let closure_body = cx.tcx.hir().body(body_id);
132+
let closure_body = cx.tcx.hir().body(body);
126133
// make sure there's only one parameter (`|_|`)
127134
if closure_body.params.len() == 1 {
128135
// make sure that parameter is the wild token (`_`)
@@ -132,7 +139,7 @@ impl<'tcx> LateLintPass<'tcx> for MapErrIgnore {
132139
span_lint_and_help(
133140
cx,
134141
MAP_ERR_IGNORE,
135-
body_span,
142+
fn_decl_span,
136143
"`map_err(|_|...` wildcard pattern discards the original error",
137144
None,
138145
"consider storing the original error as a source in the new error, or silence this warning using an ignored identifier (`.map_err(|_foo| ...`)",

clippy_lints/src/map_unit_fn.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@ 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(_, decl, inner_expr_id, _, _) = expr.kind;
173-
let body = cx.tcx.hir().body(inner_expr_id);
172+
if let hir::ExprKind::Closure { fn_decl, body, .. } = expr.kind;
173+
let body = cx.tcx.hir().body(body);
174174
let body_expr = &body.value;
175-
if decl.inputs.len() == 1;
175+
if fn_decl.inputs.len() == 1;
176176
if is_unit_expression(cx, body_expr);
177-
if let Some(binding) = iter_input_pats(decl, body).next();
177+
if let Some(binding) = iter_input_pats(fn_decl, body).next();
178178
then {
179179
return Some((binding, body_expr));
180180
}

clippy_lints/src/matches/match_single_binding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ fn sugg_with_curlies<'a>(
177177

178178
let (mut cbrace_start, mut cbrace_end) = (String::new(), String::new());
179179
if let Some(parent_expr) = get_parent_expr(cx, match_expr) {
180-
if let ExprKind::Closure(..) = parent_expr.kind {
180+
if let ExprKind::Closure { .. } = parent_expr.kind {
181181
cbrace_end = format!("\n{}}}", indent);
182182
// Fix body indent due to the closure
183183
indent = " ".repeat(indent_of(cx, bind_names).unwrap_or(0));

clippy_lints/src/matches/significant_drop_in_scrutinee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl<'a, 'tcx> Visitor<'tcx> for SigDropHelper<'a, 'tcx> {
305305
ExprKind::Break(_, _) |
306306
ExprKind::Cast(_, _) |
307307
// Don't want to check the closure itself, only invocation, which is covered by MethodCall
308-
ExprKind::Closure(_, _, _, _, _) |
308+
ExprKind::Closure { .. } |
309309
ExprKind::ConstBlock(_) |
310310
ExprKind::Continue(_) |
311311
ExprKind::DropTemps(_) |

clippy_lints/src/methods/bind_instead_of_map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ pub(crate) trait BindInsteadOfMap {
150150
}
151151

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

157-
if Self::lint_closure_autofixable(cx, expr, recv, closure_expr, closure_args_span) {
157+
if Self::lint_closure_autofixable(cx, expr, recv, closure_expr, fn_decl_span) {
158158
true
159159
} else {
160160
Self::lint_closure(cx, expr, closure_expr)

clippy_lints/src/methods/filter_map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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(_, _, c, _, _) => {
26-
let body = cx.tcx.hir().body(*c);
25+
hir::ExprKind::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(_, _, filter_body_id, ..) = filter_arg.kind;
109+
if let ExprKind::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(_, _, map_body_id, ..) = map_arg.kind;
132+
if let ExprKind::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;

clippy_lints/src/methods/option_as_ref_deref.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ 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_id, _, _) => {
55-
let closure_body = cx.tcx.hir().body(body_id);
54+
hir::ExprKind::Closure { body, .. } => {
55+
let closure_body = cx.tcx.hir().body(body);
5656
let closure_expr = peel_blocks(&closure_body.value);
5757

5858
match &closure_expr.kind {

clippy_lints/src/methods/option_map_or_none.rs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,26 @@ 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(_, _, id, span, _) = map_arg.kind;
75-
let arg_snippet = snippet(cx, span, "..");
76-
let body = cx.tcx.hir().body(id);
77-
if let Some((func, [arg_char])) = reduce_unit_expression(&body.value);
78-
if let Some(id) = path_def_id(cx, func).map(|ctor_id| cx.tcx.parent(ctor_id));
79-
if Some(id) == cx.tcx.lang_items().option_some_variant();
80-
then {
81-
let func_snippet = snippet(cx, arg_char.span, "..");
82-
let msg = "called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling \
83-
`map(..)` instead";
84-
return span_lint_and_sugg(
85-
cx,
86-
OPTION_MAP_OR_NONE,
87-
expr.span,
88-
msg,
89-
"try using `map` instead",
90-
format!("{0}.map({1} {2})", self_snippet, arg_snippet,func_snippet),
91-
Applicability::MachineApplicable,
92-
);
93-
}
94-
74+
if let hir::ExprKind::Closure { body, fn_decl_span, .. } = map_arg.kind;
75+
let arg_snippet = snippet(cx, fn_decl_span, "..");
76+
let body = cx.tcx.hir().body(body);
77+
if let Some((func, [arg_char])) = reduce_unit_expression(&body.value);
78+
if let Some(id) = path_def_id(cx, func).map(|ctor_id| cx.tcx.parent(ctor_id));
79+
if Some(id) == cx.tcx.lang_items().option_some_variant();
80+
then {
81+
let func_snippet = snippet(cx, arg_char.span, "..");
82+
let msg = "called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling \
83+
`map(..)` instead";
84+
return span_lint_and_sugg(
85+
cx,
86+
OPTION_MAP_OR_NONE,
87+
expr.span,
88+
msg,
89+
"try using `map` instead",
90+
format!("{0}.map({1} {2})", self_snippet, arg_snippet,func_snippet),
91+
Applicability::MachineApplicable,
92+
);
93+
}
9594
}
9695

9796
let func_snippet = snippet(cx, map_arg.span, "..");

clippy_lints/src/methods/search_is_some.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ 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_id, ..) = search_arg.kind;
45-
let closure_body = cx.tcx.hir().body(body_id);
44+
if let hir::ExprKind::Closure { body, .. } = search_arg.kind;
45+
let closure_body = cx.tcx.hir().body(body);
4646
if let Some(closure_arg) = closure_body.params.get(0);
4747
then {
4848
if let hir::PatKind::Ref(..) = closure_arg.pat.kind {

clippy_lints/src/methods/unnecessary_filter_map.rs

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

21-
if let hir::ExprKind::Closure(_, _, body_id, ..) = arg.kind {
22-
let body = cx.tcx.hir().body(body_id);
21+
if let hir::ExprKind::Closure { body, .. } = arg.kind {
22+
let body = cx.tcx.hir().body(body);
2323
let arg_id = body.params[0].pat.hir_id;
2424
let mutates_arg =
2525
mutated_variables(&body.value, cx).map_or(true, |used_mutably| used_mutably.contains(&arg_id));

clippy_lints/src/methods/unnecessary_fold.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ 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_id, _, _) = acc.kind;
33-
let closure_body = cx.tcx.hir().body(body_id);
32+
if let hir::ExprKind::Closure { body, .. } = acc.kind;
33+
let closure_body = cx.tcx.hir().body(body);
3434
let closure_expr = peel_blocks(&closure_body.value);
3535

3636
// Check if the closure body is of the form `acc <op> some_expr(x)`

clippy_lints/src/methods/unnecessary_lazy_eval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ 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(_, _, eid, _, _) = arg.kind {
26-
let body = cx.tcx.hir().body(eid);
25+
if let hir::ExprKind::Closure { body, .. } = arg.kind {
26+
let body = cx.tcx.hir().body(body);
2727
let body_expr = &body.value;
2828

2929
if usage::BindingUsageFinder::are_params_used(cx, body) {

clippy_lints/src/mixed_read_write_in_expression.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ struct DivergenceVisitor<'a, 'tcx> {
112112
impl<'a, 'tcx> DivergenceVisitor<'a, 'tcx> {
113113
fn maybe_walk_expr(&mut self, e: &'tcx Expr<'_>) {
114114
match e.kind {
115-
ExprKind::Closure(..) => {},
115+
ExprKind::Closure { .. } => {},
116116
ExprKind::Match(e, arms, _) => {
117117
self.visit_expr(e);
118118
for arm in arms {
@@ -243,7 +243,7 @@ fn check_expr<'a, 'tcx>(vis: &mut ReadVisitor<'a, 'tcx>, expr: &'tcx Expr<'_>) -
243243
walk_expr(vis, expr);
244244
}
245245
},
246-
ExprKind::Closure(_, _, _, _, _) => {
246+
ExprKind::Closure { .. } => {
247247
// Either
248248
//
249249
// * `var` is defined in the closure body, in which case we've reached the top of the enclosing
@@ -315,7 +315,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ReadVisitor<'a, 'tcx> {
315315
// We're about to descend a closure. Since we don't know when (or
316316
// if) the closure will be evaluated, any reads in it might not
317317
// occur here (or ever). Like above, bail to avoid false positives.
318-
ExprKind::Closure(_, _, _, _, _) |
318+
ExprKind::Closure{..} |
319319

320320
// We want to avoid a false positive when a variable name occurs
321321
// only to have its address taken, so we stop here. Technically,

0 commit comments

Comments
 (0)