Files
rust/tests/ui/manual_ok_err.stderr
Samuel Tardieu 66d19d84ae manual_ok_err: blockify the replacement of an else if …
If the part being replaced is an `if` expression following an `else`,
the replacement expression must be blockified.
2025-02-17 15:49:44 +01:00

116 lines
2.7 KiB
Plaintext

error: manual implementation of `ok`
--> tests/ui/manual_ok_err.rs:8:13
|
LL | let _ = match funcall() {
| _____________^
LL | |
LL | | Ok(v) => Some(v),
LL | | Err(_) => None,
LL | | };
| |_____^ help: replace with: `funcall().ok()`
|
= note: `-D clippy::manual-ok-err` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::manual_ok_err)]`
error: manual implementation of `ok`
--> tests/ui/manual_ok_err.rs:14:13
|
LL | let _ = match funcall() {
| _____________^
LL | |
LL | | Ok(v) => Some(v),
LL | | _v => None,
LL | | };
| |_____^ help: replace with: `funcall().ok()`
error: manual implementation of `err`
--> tests/ui/manual_ok_err.rs:20:13
|
LL | let _ = match funcall() {
| _____________^
LL | |
LL | | Err(v) => Some(v),
LL | | Ok(_) => None,
LL | | };
| |_____^ help: replace with: `funcall().err()`
error: manual implementation of `err`
--> tests/ui/manual_ok_err.rs:26:13
|
LL | let _ = match funcall() {
| _____________^
LL | |
LL | | Err(v) => Some(v),
LL | | _v => None,
LL | | };
| |_____^ help: replace with: `funcall().err()`
error: manual implementation of `ok`
--> tests/ui/manual_ok_err.rs:32:13
|
LL | let _ = if let Ok(v) = funcall() {
| _____________^
LL | |
LL | |
LL | | Some(v)
LL | | } else {
LL | | None
LL | | };
| |_____^ help: replace with: `funcall().ok()`
error: manual implementation of `err`
--> tests/ui/manual_ok_err.rs:40:13
|
LL | let _ = if let Err(v) = funcall() {
| _____________^
LL | |
LL | |
LL | | Some(v)
LL | | } else {
LL | | None
LL | | };
| |_____^ help: replace with: `funcall().err()`
error: manual implementation of `ok`
--> tests/ui/manual_ok_err.rs:49:13
|
LL | let _ = match funcall() {
| _____________^
LL | |
LL | | Ok(v) => Some(v),
LL | | _v @ _ => None,
LL | | };
| |_____^ help: replace with: `funcall().ok()`
error: manual implementation of `ok`
--> tests/ui/manual_ok_err.rs:66:13
|
LL | let _ = match -S {
| _____________^
LL | |
LL | | Ok(v) => Some(v),
LL | | _ => None,
LL | | };
| |_____^ help: replace with: `(-S).ok()`
error: manual implementation of `ok`
--> tests/ui/manual_ok_err.rs:132:12
|
LL | } else if let Ok(n) = "1".parse::<u8>() {
| ____________^
LL | | Some(n)
LL | | } else {
LL | | None
LL | | };
| |_____^
|
help: replace with
|
LL ~ } else {
LL + "1".parse::<u8>().ok()
LL ~ };
|
error: aborting due to 9 previous errors