rust-clippy/tests/ui/or_then_unwrap.stderr

23 lines
904 B
Text
Raw Normal View History

2022-03-20 22:43:17 +00:00
error: found `.or(Some(…)).unwrap()`
2023-07-27 11:40:22 +00:00
--> $DIR/or_then_unwrap.rs:22:20
2022-03-17 17:57:28 +00:00
|
LL | let _ = option.or(Some("fallback")).unwrap(); // should trigger lint
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or("fallback")`
2022-03-17 17:57:28 +00:00
|
= note: `-D clippy::or-then-unwrap` implied by `-D warnings`
2022-03-17 17:57:28 +00:00
2022-03-20 22:43:17 +00:00
error: found `.or(Ok(…)).unwrap()`
2023-07-27 11:40:22 +00:00
--> $DIR/or_then_unwrap.rs:25:20
2022-03-17 17:57:28 +00:00
|
LL | let _ = result.or::<&str>(Ok("fallback")).unwrap(); // should trigger lint
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or("fallback")`
2022-03-17 17:57:28 +00:00
2022-03-20 22:43:17 +00:00
error: found `.or(Some(…)).unwrap()`
2023-07-27 11:40:22 +00:00
--> $DIR/or_then_unwrap.rs:29:31
2022-03-19 17:17:43 +00:00
|
LL | let _ = option.map(|v| v).or(Some("fallback")).unwrap().to_string().chars(); // should trigger lint
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or("fallback")`
2022-03-19 17:17:43 +00:00
error: aborting due to 3 previous errors
2022-03-17 17:57:28 +00:00