3 #![warn(clippy::manual_map)]
4 #![allow(clippy::toplevel_ref_arg)]
7 // Lint. `y` is declared within the arm, so it isn't captured by the map closure
8 let _ = match Some(0) {
10 let y = (String::new(), String::new());
16 // Don't lint. `s` is borrowed until partway through the arm, but needs to be captured by the map
18 let s = Some(String::new());
20 Some(x) => Some((x.clone(), s)),
24 // Don't lint. `s` is borrowed until partway through the arm, but needs to be captured by the map
26 let s = Some(String::new());
29 let clone = x.clone();
36 // Don't lint. `s` is borrowed until partway through the arm, but needs to be captured as a mutable
37 // reference by the map closure
38 let mut s = Some(String::new());
41 let clone = x.clone();
48 // Lint. `s` is captured by reference, so no lifetime issues.
49 let s = Some(String::new());
52 if let Some(ref s) = s { (x.clone(), s) } else { panic!() }
58 unsafe fn f(x: u32) -> u32 {
62 let _ = match Some(0) {
63 Some(x) => Some(f(x)),
67 let _ = match Some(0) {
68 Some(x) => unsafe { Some(f(x)) },
71 let _ = match Some(0) {
72 Some(x) => Some(unsafe { f(x) }),