2020-10-23 15:16:59 -05:00
|
|
|
error: this pattern reimplements `Option::unwrap_or`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:11:5
|
2020-10-23 15:16:59 -05:00
|
|
|
|
|
|
|
|
LL | / match Some(1) {
|
|
|
|
LL | | Some(i) => i,
|
|
|
|
LL | | None => 42,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Some(1).unwrap_or(42)`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::manual-unwrap-or` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_unwrap_or)]`
|
2020-10-23 15:16:59 -05:00
|
|
|
|
|
|
|
error: this pattern reimplements `Option::unwrap_or`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:17:5
|
2020-10-23 15:16:59 -05:00
|
|
|
|
|
|
|
|
LL | / match Some(1) {
|
|
|
|
LL | | None => 42,
|
|
|
|
LL | | Some(i) => i,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Some(1).unwrap_or(42)`
|
|
|
|
|
|
|
|
error: this pattern reimplements `Option::unwrap_or`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:23:5
|
2020-10-23 15:16:59 -05:00
|
|
|
|
|
|
|
|
LL | / match Some(1) {
|
|
|
|
LL | | Some(i) => i,
|
|
|
|
LL | | None => 1 + 42,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Some(1).unwrap_or(1 + 42)`
|
|
|
|
|
|
|
|
error: this pattern reimplements `Option::unwrap_or`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:30:5
|
2020-10-23 15:16:59 -05:00
|
|
|
|
|
|
|
|
LL | / match Some(1) {
|
|
|
|
LL | | Some(i) => i,
|
|
|
|
LL | | None => {
|
|
|
|
LL | | 42 + 42
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: replace with
|
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ Some(1).unwrap_or({
|
|
|
|
LL + 42 + 42
|
|
|
|
LL + + 42 + 42 + 42
|
|
|
|
LL + + 42 + 42 + 42
|
|
|
|
LL ~ });
|
2020-10-23 15:16:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: this pattern reimplements `Option::unwrap_or`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:40:5
|
2020-10-23 15:16:59 -05:00
|
|
|
|
|
|
|
|
LL | / match Some("Bob") {
|
|
|
|
LL | | Some(i) => i,
|
|
|
|
LL | | None => "Alice",
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Some("Bob").unwrap_or("Alice")`
|
|
|
|
|
2024-06-08 08:34:59 -05:00
|
|
|
error: this pattern reimplements `Option::unwrap_or`
|
|
|
|
--> tests/ui/manual_unwrap_or.rs:87:5
|
|
|
|
|
|
|
|
|
LL | / if let Some(x) = Some(1) {
|
|
|
|
LL | | x
|
|
|
|
LL | | } else {
|
|
|
|
LL | | 42
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Some(1).unwrap_or(42)`
|
|
|
|
|
2020-10-28 17:36:07 -05:00
|
|
|
error: this pattern reimplements `Result::unwrap_or`
|
2024-06-08 08:34:59 -05:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:120:5
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
|
|
|
LL | / match Ok::<i32, &str>(1) {
|
|
|
|
LL | | Ok(i) => i,
|
|
|
|
LL | | Err(_) => 42,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(42)`
|
|
|
|
|
|
|
|
error: this pattern reimplements `Result::unwrap_or`
|
2024-06-08 08:34:59 -05:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:127:5
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
|
|
|
LL | / match a {
|
|
|
|
LL | | Ok(i) => i,
|
|
|
|
LL | | Err(_) => 42,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `a.unwrap_or(42)`
|
|
|
|
|
|
|
|
error: this pattern reimplements `Result::unwrap_or`
|
2024-06-08 08:34:59 -05:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:133:5
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
|
|
|
LL | / match Ok(1) as Result<i32, &str> {
|
|
|
|
LL | | Ok(i) => i,
|
|
|
|
LL | | Err(_) => 42,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `(Ok(1) as Result<i32, &str>).unwrap_or(42)`
|
|
|
|
|
|
|
|
error: this pattern reimplements `Option::unwrap_or`
|
2024-06-08 08:34:59 -05:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:146:5
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
|
|
|
LL | / match s.method() {
|
|
|
|
LL | | Some(i) => i,
|
|
|
|
LL | | None => 42,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `s.method().unwrap_or(42)`
|
|
|
|
|
|
|
|
error: this pattern reimplements `Result::unwrap_or`
|
2024-06-08 08:34:59 -05:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:152:5
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
|
|
|
LL | / match Ok::<i32, &str>(1) {
|
|
|
|
LL | | Err(_) => 42,
|
|
|
|
LL | | Ok(i) => i,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(42)`
|
|
|
|
|
|
|
|
error: this pattern reimplements `Result::unwrap_or`
|
2024-06-08 08:34:59 -05:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:158:5
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
|
|
|
LL | / match Ok::<i32, &str>(1) {
|
|
|
|
LL | | Ok(i) => i,
|
|
|
|
LL | | Err(_) => 1 + 42,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(1 + 42)`
|
|
|
|
|
|
|
|
error: this pattern reimplements `Result::unwrap_or`
|
2024-06-08 08:34:59 -05:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:165:5
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
|
|
|
LL | / match Ok::<i32, &str>(1) {
|
|
|
|
LL | | Ok(i) => i,
|
|
|
|
LL | | Err(_) => {
|
|
|
|
LL | | 42 + 42
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: replace with
|
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ Ok::<i32, &str>(1).unwrap_or({
|
|
|
|
LL + 42 + 42
|
|
|
|
LL + + 42 + 42 + 42
|
|
|
|
LL + + 42 + 42 + 42
|
|
|
|
LL ~ });
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: this pattern reimplements `Result::unwrap_or`
|
2024-06-08 08:34:59 -05:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:175:5
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
|
|
|
LL | / match Ok::<&str, &str>("Bob") {
|
|
|
|
LL | | Ok(i) => i,
|
|
|
|
LL | | Err(_) => "Alice",
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Ok::<&str, &str>("Bob").unwrap_or("Alice")`
|
|
|
|
|
2024-06-08 08:34:59 -05:00
|
|
|
error: this pattern reimplements `Result::unwrap_or`
|
|
|
|
--> tests/ui/manual_unwrap_or.rs:211:5
|
|
|
|
|
|
|
|
|
LL | / if let Ok(x) = Ok::<i32, i32>(1) {
|
|
|
|
LL | | x
|
|
|
|
LL | | } else {
|
|
|
|
LL | | 42
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Ok::<i32, i32>(1).unwrap_or(42)`
|
|
|
|
|
2021-04-27 09:55:11 -05:00
|
|
|
error: this pattern reimplements `Option::unwrap_or`
|
2024-06-08 08:34:59 -05:00
|
|
|
--> tests/ui/manual_unwrap_or.rs:265:17
|
2021-04-27 09:55:11 -05:00
|
|
|
|
|
|
|
|
LL | let _ = match some_macro!() {
|
|
|
|
| _________________^
|
|
|
|
LL | | Some(val) => val,
|
|
|
|
LL | | None => 0,
|
|
|
|
LL | | };
|
|
|
|
| |_________^ help: replace with: `some_macro!().unwrap_or(0)`
|
|
|
|
|
2024-06-08 08:34:59 -05:00
|
|
|
error: aborting due to 16 previous errors
|
2020-10-23 15:16:59 -05:00
|
|
|
|