2020-10-11 20:55:05 +00:00
|
|
|
error: this pattern reimplements `Option::unwrap_or`
|
|
|
|
--> $DIR/manual_unwrap_or.rs:6:5
|
2020-10-06 09:49:08 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(1) {
|
|
|
|
LL | | Some(i) => i,
|
|
|
|
LL | | None => 42,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Some(1).unwrap_or(42)`
|
|
|
|
|
|
2020-10-11 20:55:05 +00:00
|
|
|
= note: `-D clippy::manual-unwrap-or` implied by `-D warnings`
|
2020-10-06 09:49:08 +00:00
|
|
|
|
2020-10-11 20:55:05 +00:00
|
|
|
error: this pattern reimplements `Option::unwrap_or`
|
|
|
|
--> $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_else`
|
|
|
|
--> $DIR/manual_unwrap_or.rs:18:5
|
2020-10-06 09:49:08 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(1) {
|
|
|
|
LL | | Some(i) => i,
|
|
|
|
LL | | None => 1 + 42,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Some(1).unwrap_or_else(|| 1 + 42)`
|
|
|
|
|
2020-10-11 20:55:05 +00:00
|
|
|
error: this pattern reimplements `Option::unwrap_or_else`
|
|
|
|
--> $DIR/manual_unwrap_or.rs:24:5
|
2020-10-06 09:49:08 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(1) {
|
|
|
|
LL | | Some(i) => i,
|
|
|
|
LL | | None => {
|
|
|
|
LL | | let a = 1 + 42;
|
|
|
|
... |
|
|
|
|
LL | | },
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: replace with
|
|
|
|
|
|
|
|
|
LL | Some(1).unwrap_or_else(|| {
|
|
|
|
LL | let a = 1 + 42;
|
|
|
|
LL | let b = a + 42;
|
|
|
|
LL | b + 42
|
|
|
|
LL | });
|
|
|
|
|
|
|
|
|
|
2020-10-11 20:55:05 +00:00
|
|
|
error: this pattern reimplements `Option::unwrap_or`
|
|
|
|
--> $DIR/manual_unwrap_or.rs:34:5
|
2020-10-06 09:49:08 +00:00
|
|
|
|
|
|
|
|
LL | / match Some("Bob") {
|
|
|
|
LL | | Some(i) => i,
|
|
|
|
LL | | None => "Alice",
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace with: `Some("Bob").unwrap_or("Alice")`
|
|
|
|
|
2020-10-11 20:55:05 +00:00
|
|
|
error: aborting due to 5 previous errors
|
2020-10-06 09:49:08 +00:00
|
|
|
|