Account for possible boxable impl Future
in semicolon removal suggestions
This commit is contained in:
parent
a4ee3ca1e4
commit
671d7c4afb
7 changed files with 152 additions and 32 deletions
|
@ -688,13 +688,22 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
};
|
||||
let msg = "`match` arms have incompatible types";
|
||||
err.span_label(outer_error_span, msg);
|
||||
if let Some(sp) = semi_span {
|
||||
err.span_suggestion_short(
|
||||
sp,
|
||||
"consider removing this semicolon",
|
||||
String::new(),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
if let Some((sp, boxed)) = semi_span {
|
||||
if boxed {
|
||||
err.span_suggestion_verbose(
|
||||
sp,
|
||||
"consider removing this semicolon and boxing the expression",
|
||||
String::new(),
|
||||
Applicability::HasPlaceholders,
|
||||
);
|
||||
} else {
|
||||
err.span_suggestion_short(
|
||||
sp,
|
||||
"consider removing this semicolon",
|
||||
String::new(),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
}
|
||||
if let Some(ret_sp) = opt_suggest_box_span {
|
||||
// Get return type span and point to it.
|
||||
|
@ -717,13 +726,22 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
if let Some(sp) = outer {
|
||||
err.span_label(sp, "`if` and `else` have incompatible types");
|
||||
}
|
||||
if let Some(sp) = semicolon {
|
||||
err.span_suggestion_short(
|
||||
sp,
|
||||
"consider removing this semicolon",
|
||||
String::new(),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
if let Some((sp, boxed)) = semicolon {
|
||||
if boxed {
|
||||
err.span_suggestion_verbose(
|
||||
sp,
|
||||
"consider removing this semicolon and boxing the expression",
|
||||
String::new(),
|
||||
Applicability::HasPlaceholders,
|
||||
);
|
||||
} else {
|
||||
err.span_suggestion_short(
|
||||
sp,
|
||||
"consider removing this semicolon",
|
||||
String::new(),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
}
|
||||
if let Some(ret_sp) = opt_suggest_box_span {
|
||||
self.suggest_boxing_for_return_impl_trait(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue