diff options
| author | Michael Goulet <michael@errs.io> | 2023-10-13 08:58:33 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-10-13 08:59:36 +0000 |
| commit | b2d2184edea578109a48ec3d8decbee5948e8f35 (patch) | |
| tree | 84a351b1b08b838e0adcb1062ec04c344524e6c2 /compiler/rustc_mir_build/src/lints.rs | |
| parent | 2763ca50da1192aa28295ef4dbe5d06443e1b90a (diff) | |
| download | rust-b2d2184edea578109a48ec3d8decbee5948e8f35.tar.gz rust-b2d2184edea578109a48ec3d8decbee5948e8f35.zip | |
Format all the let chains in compiler
Diffstat (limited to 'compiler/rustc_mir_build/src/lints.rs')
| -rw-r--r-- | compiler/rustc_mir_build/src/lints.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/compiler/rustc_mir_build/src/lints.rs b/compiler/rustc_mir_build/src/lints.rs index 94be38beee4..e78274b4284 100644 --- a/compiler/rustc_mir_build/src/lints.rs +++ b/compiler/rustc_mir_build/src/lints.rs @@ -67,16 +67,21 @@ pub fn check_drop_recursion<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) { let def_id = body.source.def_id().expect_local(); // First check if `body` is an `fn drop()` of `Drop` - if let DefKind::AssocFn = tcx.def_kind(def_id) && - let Some(trait_ref) = tcx.impl_of_method(def_id.to_def_id()).and_then(|def_id| tcx.impl_trait_ref(def_id)) && - let Some(drop_trait) = tcx.lang_items().drop_trait() && drop_trait == trait_ref.instantiate_identity().def_id { - + if let DefKind::AssocFn = tcx.def_kind(def_id) + && let Some(trait_ref) = + tcx.impl_of_method(def_id.to_def_id()).and_then(|def_id| tcx.impl_trait_ref(def_id)) + && let Some(drop_trait) = tcx.lang_items().drop_trait() + && drop_trait == trait_ref.instantiate_identity().def_id + { // It was. Now figure out for what type `Drop` is implemented and then // check for recursion. - if let ty::Ref(_, dropped_ty, _) = tcx.liberate_late_bound_regions( - def_id.to_def_id(), - tcx.fn_sig(def_id).instantiate_identity().input(0), - ).kind() { + if let ty::Ref(_, dropped_ty, _) = tcx + .liberate_late_bound_regions( + def_id.to_def_id(), + tcx.fn_sig(def_id).instantiate_identity().input(0), + ) + .kind() + { check_recursion(tcx, body, RecursiveDrop { drop_for: *dropped_ty }); } } |
