mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-01 00:49:30 +00:00
57 lines
1.6 KiB
Text
57 lines
1.6 KiB
Text
|
error: match can be simplified with `.unwrap_or_default()`
|
||
|
--> tests/ui/manual_unwrap_or_default.rs:6:5
|
||
|
|
|
||
|
LL | / match x {
|
||
|
LL | |
|
||
|
LL | | Some(v) => v,
|
||
|
LL | | None => Vec::default(),
|
||
|
LL | | };
|
||
|
| |_____^ help: replace it with: `x.unwrap_or_default()`
|
||
|
|
|
||
|
= note: `-D clippy::manual-unwrap-or-default` implied by `-D warnings`
|
||
|
= help: to override `-D warnings` add `#[allow(clippy::manual_unwrap_or_default)]`
|
||
|
|
||
|
error: match can be simplified with `.unwrap_or_default()`
|
||
|
--> tests/ui/manual_unwrap_or_default.rs:13:5
|
||
|
|
|
||
|
LL | / match x {
|
||
|
LL | |
|
||
|
LL | | Some(v) => v,
|
||
|
LL | | _ => Vec::default(),
|
||
|
LL | | };
|
||
|
| |_____^ help: replace it with: `x.unwrap_or_default()`
|
||
|
|
||
|
error: match can be simplified with `.unwrap_or_default()`
|
||
|
--> tests/ui/manual_unwrap_or_default.rs:20:5
|
||
|
|
|
||
|
LL | / match x {
|
||
|
LL | |
|
||
|
LL | | Some(v) => v,
|
||
|
LL | | None => String::new(),
|
||
|
LL | | };
|
||
|
| |_____^ help: replace it with: `x.unwrap_or_default()`
|
||
|
|
||
|
error: match can be simplified with `.unwrap_or_default()`
|
||
|
--> tests/ui/manual_unwrap_or_default.rs:27:5
|
||
|
|
|
||
|
LL | / match x {
|
||
|
LL | |
|
||
|
LL | | None => Vec::default(),
|
||
|
LL | | Some(v) => v,
|
||
|
LL | | };
|
||
|
| |_____^ help: replace it with: `x.unwrap_or_default()`
|
||
|
|
||
|
error: if let can be simplified with `.unwrap_or_default()`
|
||
|
--> tests/ui/manual_unwrap_or_default.rs:34:5
|
||
|
|
|
||
|
LL | / if let Some(v) = x {
|
||
|
LL | |
|
||
|
LL | | v
|
||
|
LL | | } else {
|
||
|
LL | | Vec::default()
|
||
|
LL | | };
|
||
|
| |_____^ help: replace it with: `x.unwrap_or_default()`
|
||
|
|
||
|
error: aborting due to 5 previous errors
|
||
|
|