diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2022-03-17 14:55:16 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2022-03-17 14:55:16 -0300 |
| commit | ba8b4a4f824ea1fa1f5e31ab619599be80f14a34 (patch) | |
| tree | 982ae9e1d1b3d7705eee8650d0533fb7044fe1e0 | |
| parent | 9c076f3f90444183d4d51754f19ea55a801e0e05 (diff) | |
Use let else here
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/coherence.rs | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index 60111446b94..6c3ce3ee371 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -387,42 +387,42 @@ fn resolve_negative_obligation<'cx, 'tcx>( ) -> bool { let tcx = infcx.tcx; - if let Some(o) = o.flip_polarity(tcx) { - let mut fulfillment_cx = FulfillmentContext::new(); - fulfillment_cx.register_predicate_obligation(infcx, o); + let Some(o) = o.flip_polarity(tcx) else { + return false; + }; - let errors = fulfillment_cx.select_all_or_error(infcx); + let mut fulfillment_cx = FulfillmentContext::new(); + fulfillment_cx.register_predicate_obligation(infcx, o); - if !errors.is_empty() { - return false; - } + let errors = fulfillment_cx.select_all_or_error(infcx); - let mut outlives_env = OutlivesEnvironment::new(param_env); - // FIXME -- add "assumed to be well formed" types into the `outlives_env` + if !errors.is_empty() { + return false; + } - // "Save" the accumulated implied bounds into the outlives environment - // (due to the FIXME above, there aren't any, but this step is still needed). - // The "body id" is given as `CRATE_HIR_ID`, which is the same body-id used - // by the "dummy" causes elsewhere (body-id is only relevant when checking - // function bodies with closures). - outlives_env.save_implied_bounds(CRATE_HIR_ID); + let mut outlives_env = OutlivesEnvironment::new(param_env); + // FIXME -- add "assumed to be well formed" types into the `outlives_env` - infcx.process_registered_region_obligations( - outlives_env.region_bound_pairs_map(), - Some(tcx.lifetimes.re_root_empty), - param_env, - ); + // "Save" the accumulated implied bounds into the outlives environment + // (due to the FIXME above, there aren't any, but this step is still needed). + // The "body id" is given as `CRATE_HIR_ID`, which is the same body-id used + // by the "dummy" causes elsewhere (body-id is only relevant when checking + // function bodies with closures). + outlives_env.save_implied_bounds(CRATE_HIR_ID); - let errors = infcx.resolve_regions(region_context, &outlives_env, RegionckMode::default()); + infcx.process_registered_region_obligations( + outlives_env.region_bound_pairs_map(), + Some(tcx.lifetimes.re_root_empty), + param_env, + ); - if !errors.is_empty() { - return false; - } + let errors = infcx.resolve_regions(region_context, &outlives_env, RegionckMode::default()); - return true; + if !errors.is_empty() { + return false; } - false + true } pub fn trait_ref_is_knowable<'tcx>( |
