mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
23 lines
992 B
Text
23 lines
992 B
Text
error: found `.or(Some(…)).unwrap()`
|
|
--> tests/ui/or_then_unwrap.rs:22:20
|
|
|
|
|
LL | let _ = option.or(Some("fallback")).unwrap(); // should trigger lint
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or("fallback")`
|
|
|
|
|
= note: `-D clippy::or-then-unwrap` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::or_then_unwrap)]`
|
|
|
|
error: found `.or(Ok(…)).unwrap()`
|
|
--> tests/ui/or_then_unwrap.rs:25:20
|
|
|
|
|
LL | let _ = result.or::<&str>(Ok("fallback")).unwrap(); // should trigger lint
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or("fallback")`
|
|
|
|
error: found `.or(Some(…)).unwrap()`
|
|
--> tests/ui/or_then_unwrap.rs:29:31
|
|
|
|
|
LL | let _ = option.map(|v| v).or(Some("fallback")).unwrap().to_string().chars(); // should trigger lint
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or("fallback")`
|
|
|
|
error: aborting due to 3 previous errors
|
|
|