e9677105bf
There are two different implementation of Try trait for Poll type; Poll<Result<T, E>> and Poll<Option<Result<T, E>>>. Take them into account when generating suggestions. For example, for Err(e)? suggest either return Poll::Ready(Err(e)) or return Poll::Ready(Some(Err(e))) as appropriate.
57 lines
1.8 KiB
Plaintext
57 lines
1.8 KiB
Plaintext
error: returning an `Err(_)` with the `?` operator
|
|
--> $DIR/try_err.rs:18:9
|
|
|
|
|
LL | Err(err)?;
|
|
| ^^^^^^^^^ help: try this: `return Err(err)`
|
|
|
|
|
note: the lint level is defined here
|
|
--> $DIR/try_err.rs:4:9
|
|
|
|
|
LL | #![deny(clippy::try_err)]
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
error: returning an `Err(_)` with the `?` operator
|
|
--> $DIR/try_err.rs:28:9
|
|
|
|
|
LL | Err(err)?;
|
|
| ^^^^^^^^^ help: try this: `return Err(err.into())`
|
|
|
|
error: returning an `Err(_)` with the `?` operator
|
|
--> $DIR/try_err.rs:48:17
|
|
|
|
|
LL | Err(err)?;
|
|
| ^^^^^^^^^ help: try this: `return Err(err)`
|
|
|
|
error: returning an `Err(_)` with the `?` operator
|
|
--> $DIR/try_err.rs:67:17
|
|
|
|
|
LL | Err(err)?;
|
|
| ^^^^^^^^^ help: try this: `return Err(err.into())`
|
|
|
|
error: returning an `Err(_)` with the `?` operator
|
|
--> $DIR/try_err.rs:106:9
|
|
|
|
|
LL | Err(foo!())?;
|
|
| ^^^^^^^^^^^^ help: try this: `return Err(foo!())`
|
|
|
|
error: returning an `Err(_)` with the `?` operator
|
|
--> $DIR/try_err.rs:113:9
|
|
|
|
|
LL | Err(io::ErrorKind::WriteZero)?
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `return Poll::Ready(Err(io::ErrorKind::WriteZero.into()))`
|
|
|
|
error: returning an `Err(_)` with the `?` operator
|
|
--> $DIR/try_err.rs:115:9
|
|
|
|
|
LL | Err(io::Error::new(io::ErrorKind::InvalidInput, "error"))?
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `return Poll::Ready(Err(io::Error::new(io::ErrorKind::InvalidInput, "error")))`
|
|
|
|
error: returning an `Err(_)` with the `?` operator
|
|
--> $DIR/try_err.rs:123:9
|
|
|
|
|
LL | Err(io::ErrorKind::NotFound)?
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `return Poll::Ready(Some(Err(io::ErrorKind::NotFound.into())))`
|
|
|
|
error: aborting due to 8 previous errors
|
|
|