diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2022-06-15 19:37:14 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-15 19:37:14 +0900 |
| commit | bd071bf5b2395edced30dfc5197eafb355c49b4d (patch) | |
| tree | 832e9a4699850f25b211e0fb554030a9658b7d2d /clippy_utils/src/lib.rs | |
| parent | 196f3c0e71e8affdb7173bde486f17649da51ae9 (diff) | |
| parent | 7b84a97c3e941fe2ed1f9afcd36f9d79601a6d96 (diff) | |
| download | rust-bd071bf5b2395edced30dfc5197eafb355c49b4d.tar.gz rust-bd071bf5b2395edced30dfc5197eafb355c49b4d.zip | |
Rollup merge of #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``
Diffstat (limited to 'clippy_utils/src/lib.rs')
| -rw-r--r-- | clippy_utils/src/lib.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 5f051e3f444..0cf23ca626c 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -962,7 +962,7 @@ pub fn can_move_expr_to_closure<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<' self.captures.entry(l).and_modify(|e| *e |= cap).or_insert(cap); } }, - ExprKind::Closure(..) => { + ExprKind::Closure { .. } => { let closure_id = self.cx.tcx.hir().local_def_id(e.hir_id).to_def_id(); for capture in self.cx.typeck_results().closure_min_captures_flattened(closure_id) { let local_id = match capture.place.base { @@ -1200,7 +1200,7 @@ pub fn get_enclosing_loop_or_closure<'tcx>(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) - match node { Node::Expr( e @ Expr { - kind: ExprKind::Loop(..) | ExprKind::Closure(..), + kind: ExprKind::Loop(..) | ExprKind::Closure { .. }, .. }, ) => return Some(e), @@ -1693,7 +1693,7 @@ pub fn get_async_fn_body<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Option<&'t _, &[ Expr { - kind: ExprKind::Closure(_, _, body, _, _), + kind: ExprKind::Closure { body, .. }, .. }, ], @@ -1780,7 +1780,7 @@ pub fn is_expr_identity_function(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool } match expr.kind { - ExprKind::Closure(_, _, body_id, _, _) => is_body_identity_function(cx, cx.tcx.hir().body(body_id)), + ExprKind::Closure { body, .. } => is_body_identity_function(cx, cx.tcx.hir().body(body)), _ => path_def_id(cx, expr).map_or(false, |id| match_def_path(cx, id, &paths::CONVERT_IDENTITY)), } } |
