mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-15 01:55:03 +00:00
251dd30d77
In some cases check if a borrow made in the scrutinee expression would prevent creating the closure used by `map`
20 lines
355 B
Rust
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,
|
|
};
|
|
}
|