Commit Graph

3 Commits

Author SHA1 Message Date
Nick Torres
fb276dc3fa result_map_or_into_option: add opt.map_or(None, |_| Some(y)) test 2020-04-04 14:16:26 -07:00
Nick Torres
d0738bd673 result_map_or_into_option: destructure lint tuple or return early 2020-04-04 14:16:23 -07:00
Nick Torres
91d8a804d3 result_map_or_into_option: add lint to catch manually adpating Result -> Option
Result<T, E> has an `ok()` method that adapts a Result<T,E> into an Option<T>.
It's possible to get around this adapter by writing Result<T,E>.map_or(None, Some).

This lint is implemented as a new variant of the existing
[`option_map_none` lint](https://github.com/rust-lang/rust-clippy/pull/2128)
2020-04-04 03:17:13 -07:00