1
Fork 0

3 - Make more use of let_chains

Continuation of #94376.

cc #53667
This commit is contained in:
Caio 2022-02-27 11:10:20 -03:00
parent bab4c13f64
commit 0eb8b32de3
6 changed files with 44 additions and 58 deletions

View file

@ -1921,17 +1921,16 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
err.span_label(assigned_span, format!("first assignment to {}", place_description));
}
}
if let Some(decl) = local_decl {
if let Some(name) = local_name {
if decl.can_be_made_mutable() {
err.span_suggestion(
decl.source_info.span,
"consider making this binding mutable",
format!("mut {}", name),
Applicability::MachineApplicable,
);
}
}
if let Some(decl) = local_decl
&& let Some(name) = local_name
&& decl.can_be_made_mutable()
{
err.span_suggestion(
decl.source_info.span,
"consider making this binding mutable",
format!("mut {}", name),
Applicability::MachineApplicable,
);
}
err.span_label(span, msg);
self.buffer_error(err);