rust/tests/ui/manual_map_option_2.rs
Jason Newcomb 251dd30d77
Improve manual_map
In some cases check if a borrow made in the scrutinee expression would prevent creating the closure used by `map`
2021-08-14 19:49:54 -04:00

20 lines
355 B
Rust

// run-rustfix
#![warn(clippy::manual_map)]
fn main() {
let _ = match Some(0) {
Some(x) => Some({
let y = (String::new(), String::new());
(x, y.0)
}),
None => None,
};
let s = Some(String::new());
let _ = match &s {
Some(x) => Some((x.clone(), s)),
None => None,
};
}