further simplify a match
This commit is contained in:
parent
3f9cca3943
commit
2ea9e1d796
1 changed files with 11 additions and 12 deletions
|
@ -768,9 +768,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
||||||
let outlived_fr_name = self.give_region_a_name(*outlived_fr).unwrap();
|
let outlived_fr_name = self.give_region_a_name(*outlived_fr).unwrap();
|
||||||
outlived_fr_name.highlight_region_name(&mut diag);
|
outlived_fr_name.highlight_region_name(&mut diag);
|
||||||
|
|
||||||
let err_category = match category {
|
let err_category = if matches!(category, ConstraintCategory::Return(_))
|
||||||
ConstraintCategory::Return(_)
|
&& self.regioncx.universal_regions().is_local_free_region(*outlived_fr)
|
||||||
if self.regioncx.universal_regions().is_local_free_region(*outlived_fr) =>
|
|
||||||
{
|
{
|
||||||
LifetimeReturnCategoryErr::WrongReturn {
|
LifetimeReturnCategoryErr::WrongReturn {
|
||||||
span: *span,
|
span: *span,
|
||||||
|
@ -778,13 +777,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
||||||
outlived_fr_name,
|
outlived_fr_name,
|
||||||
fr_name: &fr_name,
|
fr_name: &fr_name,
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
_ => LifetimeReturnCategoryErr::ShortReturn {
|
LifetimeReturnCategoryErr::ShortReturn {
|
||||||
span: *span,
|
span: *span,
|
||||||
category_desc: category.description(),
|
category_desc: category.description(),
|
||||||
free_region_name: &fr_name,
|
free_region_name: &fr_name,
|
||||||
outlived_fr_name,
|
outlived_fr_name,
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
diag.subdiagnostic(err_category);
|
diag.subdiagnostic(err_category);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue