1
Fork 0

replaced some map_or with map_or_else

This commit is contained in:
klensy 2021-02-24 01:02:05 +03:00
parent 5ff1be197e
commit c75c4a579b
12 changed files with 82 additions and 70 deletions

View file

@ -349,7 +349,7 @@ fn report_negative_positive_conflict(
E0751,
"found both positive and negative implementation of trait `{}`{}:",
overlap.trait_desc,
overlap.self_desc.clone().map_or(String::new(), |ty| format!(" for type `{}`", ty))
overlap.self_desc.clone().map_or_else(|| String::new(), |ty| format!(" for type `{}`", ty))
);
match tcx.span_of_impl(negative_impl_def_id) {
@ -397,7 +397,10 @@ fn report_conflicting_impls(
let msg = format!(
"conflicting implementations of trait `{}`{}:{}",
overlap.trait_desc,
overlap.self_desc.clone().map_or(String::new(), |ty| { format!(" for type `{}`", ty) }),
overlap
.self_desc
.clone()
.map_or_else(|| String::new(), |ty| { format!(" for type `{}`", ty) }),
match used_to_be_allowed {
Some(FutureCompatOverlapErrorKind::Issue33140) => " (E0119)",
_ => "",
@ -415,7 +418,9 @@ fn report_conflicting_impls(
impl_span,
format!(
"conflicting implementation{}",
overlap.self_desc.map_or(String::new(), |ty| format!(" for `{}`", ty))
overlap
.self_desc
.map_or_else(|| String::new(), |ty| format!(" for `{}`", ty))
),
);
}