mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-15 10:07:30 +00:00
23 lines
919 B
Plaintext
23 lines
919 B
Plaintext
error: found `.or(Some(…)).unwrap()`
|
|
--> $DIR/or_then_unwrap.rs:24:20
|
|
|
|
|
LL | let _ = option.or(Some("fallback")).unwrap(); // should trigger lint
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or("fallback")`
|
|
|
|
|
= note: `-D clippy::or-then-unwrap` implied by `-D warnings`
|
|
|
|
error: found `.or(Ok(…)).unwrap()`
|
|
--> $DIR/or_then_unwrap.rs:27:20
|
|
|
|
|
LL | let _ = result.or::<&str>(Ok("fallback")).unwrap(); // should trigger lint
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or("fallback")`
|
|
|
|
error: found `.or(Some(…)).unwrap()`
|
|
--> $DIR/or_then_unwrap.rs:31:31
|
|
|
|
|
LL | let _ = option.map(|v| v).or(Some("fallback")).unwrap().to_string().chars(); // should trigger lint
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or("fallback")`
|
|
|
|
error: aborting due to 3 previous errors
|
|
|