1
Fork 0

Auto merge of #94144 - est31:let_else_trait_selection, r=cjgillot

rustc_trait_selection: adopt let else in more places

Continuation of #89933, #91018, #91481, #93046, #93590, #94011.

I have extended my clippy lint to also recognize tuple passing and match statements. The diff caused by fixing it is way above 1 thousand lines. Thus, I split it up into multiple pull requests to make reviewing easier. This PR handles rustc_trait_selection.
This commit is contained in:
bors 2022-02-27 07:02:46 +00:00
commit 9323028156
10 changed files with 75 additions and 117 deletions

View file

@ -1830,9 +1830,8 @@ fn confirm_impl_candidate<'cx, 'tcx>(
let trait_def_id = tcx.trait_id_of_impl(impl_def_id).unwrap();
let param_env = obligation.param_env;
let assoc_ty = match assoc_def(selcx, impl_def_id, assoc_item_id) {
Ok(assoc_ty) => assoc_ty,
Err(ErrorReported) => return Progress { term: tcx.ty_error().into(), obligations: nested },
let Ok(assoc_ty) = assoc_def(selcx, impl_def_id, assoc_item_id) else {
return Progress { term: tcx.ty_error().into(), obligations: nested };
};
if !assoc_ty.item.defaultness.has_value() {