3 #![warn(clippy::manual_map)]
8 clippy::match_ref_pats,
9 clippy::redundant_pattern_matching,
10 clippy::for_loops_over_fallibles,
17 Some(0).map(|x| x + 1);
19 Some("").map(|x| x.is_empty());
24 Some(0).map(std::convert::identity);
26 Some(&String::new()).map(|x| str::len(x));
29 Some(x) if false => Some(x + 1),
33 Some([0, 1]).as_ref().map(|x| x[0]);
35 Some(0).map(|x| x * 2);
37 Some(String::new()).as_ref().map(|x| x.is_empty());
39 Some(String::new()).as_ref().map(|x| x.len());
41 Some(0).map(|x| x + x);
43 #[warn(clippy::option_map_unit_fn)]
44 match &mut Some(String::new()) {
45 Some(x) => Some(x.push_str("")),
49 #[allow(clippy::option_map_unit_fn)]
51 Some(String::new()).as_mut().map(|x| x.push_str(""));
54 Some(String::new()).as_ref().map(|x| x.len());
56 Some(String::new()).as_ref().map(|x| x.is_empty());
58 Some((0, 1, 2)).map(|(x, y, z)| x + y + z);
60 Some([1, 2, 3]).map(|[first, ..]| first);
62 Some((String::new(), "test")).as_ref().map(|(x, y)| (y, x));
64 match Some((String::new(), 0)) {
65 Some((ref x, y)) => Some((y, x)),
70 Some(Some(_)) | Some(None) => Some(0),
74 match Some(Some((0, 1))) {
75 Some(Some((x, 1))) => Some(x),
80 fn f1() -> Result<(), ()> {
81 let _ = match Some(Ok(())) {
88 for &x in Some(Some(true)).iter() {
90 Some(x) => Some(if x { continue } else { x }),
96 let x1 = (Some(String::new()), 0);
99 Some(x) => Some((x, x1.1)),
108 fn f(self) -> Option<(String, u32)> {
110 Some(x) => Some((x, self.y)),
117 Some(0).map(|x| vec![x]);
119 option_env!("").map(String::from);
122 async fn f2(x: u32) -> u32 {
128 Some(x) => Some(f2(x).await),
134 if let Some(_) = Some(0) {
136 } else { Some(0).map(|x| x + 1) };
140 } else { Some(0).map(|x| x + 1) };
145 Some(x) => Some(x + 1),
151 let s = &String::new();
152 #[allow(clippy::needless_match)]
153 let _: Option<&str> = match Some(s) {