rust/tests/ui/manual_unwrap_or.stderr

156 lines
4.1 KiB
Plaintext
Raw Normal View History

error: this pattern reimplements `Option::unwrap_or`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:6:5
|
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`
error: this pattern reimplements `Option::unwrap_or`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:12:5
|
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`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:18:5
|
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`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:25:5
|
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 ~ });
|
error: this pattern reimplements `Option::unwrap_or`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:35:5
|
LL | / match Some("Bob") {
LL | | Some(i) => i,
LL | | None => "Alice",
LL | | };
| |_____^ help: replace with: `Some("Bob").unwrap_or("Alice")`
error: this pattern reimplements `Result::unwrap_or`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:85:5
|
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`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:92:5
|
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`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:98:5
|
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`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:111:5
|
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`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:117:5
|
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`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:123:5
|
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`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:130:5
|
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 ~ });
|
error: this pattern reimplements `Result::unwrap_or`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:140:5
|
LL | / match Ok::<&str, &str>("Bob") {
LL | | Ok(i) => i,
LL | | Err(_) => "Alice",
LL | | };
| |_____^ help: replace with: `Ok::<&str, &str>("Bob").unwrap_or("Alice")`
error: this pattern reimplements `Option::unwrap_or`
2023-07-27 06:40:22 -05:00
--> $DIR/manual_unwrap_or.rs:200:17
|
LL | let _ = match some_macro!() {
| _________________^
LL | | Some(val) => val,
LL | | None => 0,
LL | | };
| |_________^ help: replace with: `some_macro!().unwrap_or(0)`
error: aborting due to 14 previous errors