9 - Make more use of let_chains

Continuation of #94376.

cc #53667
This commit is contained in:
Caio
2022-03-01 18:34:35 -03:00
parent f0c4da4998
commit a7b4d667fe
8 changed files with 176 additions and 218 deletions

View File

@@ -579,24 +579,22 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
previous_stack,
subobligations,
);
if let Ok(res) = res {
if res == EvaluatedToOk || res == EvaluatedToOkModuloRegions {
if let Some(key) =
ProjectionCacheKey::from_poly_projection_predicate(
self, data,
)
{
// If the result is something that we can cache, then mark this
// entry as 'complete'. This will allow us to skip evaluating the
// suboligations at all the next time we evaluate the projection
// predicate.
self.infcx
.inner
.borrow_mut()
.projection_cache()
.complete(key, res);
}
}
if let Ok(eval_rslt) = res
&& (eval_rslt == EvaluatedToOk || eval_rslt == EvaluatedToOkModuloRegions)
&& let Some(key) =
ProjectionCacheKey::from_poly_projection_predicate(
self, data,
)
{
// If the result is something that we can cache, then mark this
// entry as 'complete'. This will allow us to skip evaluating the
// suboligations at all the next time we evaluate the projection
// predicate.
self.infcx
.inner
.borrow_mut()
.projection_cache()
.complete(key, eval_rslt);
}
res
}