tweak wording

This commit is contained in:
Esteban Küber 2023-01-23 14:46:30 +00:00
parent df81147b51
commit 62aff3bbc7
3 changed files with 8 additions and 7 deletions

View File

@ -735,7 +735,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
.must_apply_modulo_regions()
{
err.multipart_suggestion(
"you can rely on the implicit conversion that `?` does to transform the error type",
"use `?` to coerce and return an appropriate `Err`, and wrap the resulting value \
in `Ok` so the expression remains of type `Result`",
vec![
(expr.span.shrink_to_lo(), "Ok(".to_string()),
(expr.span.shrink_to_hi(), "?)".to_string()),

View File

@ -9,7 +9,7 @@ LL | true => x,
|
= note: expected enum `Result<_, B>`
found enum `Result<_, A>`
help: you can rely on the implicit conversion that `?` does to transform the error type
help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result`
|
LL | true => Ok(x?),
| +++ ++
@ -25,7 +25,7 @@ LL | true => return x,
|
= note: expected enum `Result<_, B>`
found enum `Result<_, A>`
help: you can rely on the implicit conversion that `?` does to transform the error type
help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result`
|
LL | true => return Ok(x?),
| +++ ++

View File

@ -8,7 +8,7 @@ LL | x
|
= note: expected enum `Result<_, B>`
found enum `Result<_, A>`
help: you can rely on the implicit conversion that `?` does to transform the error type
help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result`
|
LL | Ok(x?)
| +++ ++
@ -23,7 +23,7 @@ LL | return x;
|
= note: expected enum `Result<_, B>`
found enum `Result<_, A>`
help: you can rely on the implicit conversion that `?` does to transform the error type
help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result`
|
LL | return Ok(x?);
| +++ ++
@ -39,7 +39,7 @@ LL | x
|
= note: expected enum `Result<_, B>`
found enum `Result<_, A>`
help: you can rely on the implicit conversion that `?` does to transform the error type
help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result`
|
LL | Ok(x?)
| +++ ++
@ -55,7 +55,7 @@ LL | x
|
= note: expected enum `Result<_, B>`
found enum `Result<_, A>`
help: you can rely on the implicit conversion that `?` does to transform the error type
help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result`
|
LL | Ok(x?)
| +++ ++