| error: using `Option.and_then(Some)`, which is a no-op |
| --> tests/ui/bind_instead_of_map.rs:8:13 |
| | |
| LL | let _ = x.and_then(Some); |
| | ^^^^^^^^^^^^^^^^ help: use the expression directly: `x` |
| | |
| note: the lint level is defined here |
| --> tests/ui/bind_instead_of_map.rs:1:9 |
| | |
| LL | #![deny(clippy::bind_instead_of_map)] |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| |
| error: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)` |
| --> tests/ui/bind_instead_of_map.rs:10:13 |
| | |
| LL | let _ = x.and_then(|o| Some(o + 1)); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.map(|o| o + 1)` |
| |
| error: using `Result.and_then(Ok)`, which is a no-op |
| --> tests/ui/bind_instead_of_map.rs:17:13 |
| | |
| LL | let _ = x.and_then(Ok); |
| | ^^^^^^^^^^^^^^ help: use the expression directly: `x` |
| |
| error: using `Result.or_else(|x| Err(y))`, which is more succinctly expressed as `map_err(|x| y)` |
| --> tests/ui/bind_instead_of_map.rs:32:31 |
| | |
| LL | let _: Result<u32, u32> = res.or_else(|_| if b { panic!("should not happen") } else { Err(42) }); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| | |
| help: use `map_err` instead |
| | |
| LL - let _: Result<u32, u32> = res.or_else(|_| if b { panic!("should not happen") } else { Err(42) }); |
| LL + let _: Result<u32, u32> = res.map_err(|_| if b { panic!("should not happen") } else { 42 }); |
| | |
| |
| error: aborting due to 4 previous errors |
| |