rust/tests/ui/option_map_or_none.fixed
Aleksei Latyshev 07f1edf2d4
improve and generalize option_and_then_some lint
- rename it to bind_instead_of_map
2020-05-17 12:17:03 +03:00

17 lines
336 B
Rust

// run-rustfix
#![allow(clippy::bind_instead_of_map)]
fn main() {
let opt = Some(1);
// Check `OPTION_MAP_OR_NONE`.
// Single line case.
let _ = opt.and_then(|x| Some(x + 1));
// Multi-line case.
#[rustfmt::skip]
let _ = opt.and_then(|x| {
Some(x + 1)
});
}