renaming test cases
This commit is contained in:
parent
e6f48fa0bb
commit
e2ce5d74a5
5 changed files with 15 additions and 54 deletions
|
@ -1976,7 +1976,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
self.suggest_accessing_field_where_appropriate(cause, &exp_found, diag);
|
||||
self.suggest_await_on_expect_found(cause, span, &exp_found, diag);
|
||||
self.suggest_function_pointers(cause, span, &exp_found, diag);
|
||||
self.suggest_for_statments_as_exp(cause, &exp_found, diag);
|
||||
self.suggest_turning_stmt_into_expr(cause, &exp_found, diag);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -298,11 +298,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
pub(super) fn suggest_for_statments_as_exp(
|
||||
pub(super) fn suggest_turning_stmt_into_expr(
|
||||
&self,
|
||||
cause: &ObligationCause<'tcx>,
|
||||
exp_found: &ty::error::ExpectedFound<Ty<'tcx>>,
|
||||
diag: &mut Diagnostic,
|
||||
diag: &mut Diag<'_>,
|
||||
) {
|
||||
let ty::error::ExpectedFound { expected, found } = exp_found;
|
||||
if !found.peel_refs().is_unit() {
|
||||
|
@ -365,18 +365,18 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
&self,
|
||||
blk: &'tcx hir::Block<'tcx>,
|
||||
expected_ty: Ty<'tcx>,
|
||||
err: &mut Diagnostic,
|
||||
diag: &mut Diag<'_>,
|
||||
) -> bool {
|
||||
if let Some((span_semi, boxed)) = self.could_remove_semicolon(blk, expected_ty) {
|
||||
if let StatementAsExpression::NeedsBoxing = boxed {
|
||||
err.span_suggestion_verbose(
|
||||
diag.span_suggestion_verbose(
|
||||
span_semi,
|
||||
"consider removing this semicolon and boxing the expression",
|
||||
"",
|
||||
Applicability::HasPlaceholders,
|
||||
);
|
||||
} else {
|
||||
err.span_suggestion_short(
|
||||
diag.span_suggestion_short(
|
||||
span_semi,
|
||||
"remove this semicolon to return this value",
|
||||
"",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue