diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-06-11 21:25:25 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-06-12 00:16:27 +0200 |
| commit | 7b84a97c3e941fe2ed1f9afcd36f9d79601a6d96 (patch) | |
| tree | 26fcc2f623fd43948db6829189cd3af1f5d581f8 /clippy_lints/src/map_unit_fn.rs | |
| parent | e34621c24ee3e5dd9b060d04633ec4ee5f47fe40 (diff) | |
| download | rust-7b84a97c3e941fe2ed1f9afcd36f9d79601a6d96.tar.gz rust-7b84a97c3e941fe2ed1f9afcd36f9d79601a6d96.zip | |
Make `ExprKind::Closure` a struct variant.
Diffstat (limited to 'clippy_lints/src/map_unit_fn.rs')
| -rw-r--r-- | clippy_lints/src/map_unit_fn.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clippy_lints/src/map_unit_fn.rs b/clippy_lints/src/map_unit_fn.rs index f552d5c1afa..663246b4c86 100644 --- a/clippy_lints/src/map_unit_fn.rs +++ b/clippy_lints/src/map_unit_fn.rs @@ -169,12 +169,12 @@ fn unit_closure<'tcx>( expr: &hir::Expr<'_>, ) -> Option<(&'tcx hir::Param<'tcx>, &'tcx hir::Expr<'tcx>)> { if_chain! { - if let hir::ExprKind::Closure(_, decl, inner_expr_id, _, _) = expr.kind; - let body = cx.tcx.hir().body(inner_expr_id); + if let hir::ExprKind::Closure { fn_decl, body, .. } = expr.kind; + let body = cx.tcx.hir().body(body); let body_expr = &body.value; - if decl.inputs.len() == 1; + if fn_decl.inputs.len() == 1; if is_unit_expression(cx, body_expr); - if let Some(binding) = iter_input_pats(decl, body).next(); + if let Some(binding) = iter_input_pats(fn_decl, body).next(); then { return Some((binding, body_expr)); } |
