blob: 3e66b15edbd659d600aa7c974a6c426bcff389c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
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:27: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:33:20
|
LL | let _ = option.or(Some(vec!["fallback"])).unwrap(); // should trigger lint
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or(vec!["fallback"])`
error: found `.or(Some(…)).unwrap()`
--> tests/ui/or_then_unwrap.rs:39: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 4 previous errors
|