3 #![warn(clippy::manual_filter)]
4 #![allow(unused_variables, dead_code)]
7 Some(0).filter(|&x| x <= 0);
9 Some(1).filter(|&x| x <= 0);
11 Some(2).filter(|&x| x <= 0);
13 Some(3).filter(|&x| x > 0);
16 y.filter(|&x| x <= 0);
18 Some(5).filter(|&x| x > 0);
20 Some(6).as_ref().filter(|&x| x > &0);
22 let external_cond = true;
23 Some(String::new()).filter(|x| external_cond);
25 Some(7).filter(|&x| external_cond);
27 Some(8).filter(|&x| x != 0);
29 Some(9).filter(|&x| x > 10 && x < 100);
32 // Don't lint, `.filter` is not const
35 if x > 10 && x < 100 {
45 #[allow(clippy::blocks_in_if_conditions)]
46 Some(11).filter(|&x| {
52 // Don't Lint, statement is lost by `.filter`
54 if x > 10 && x < 100 {
65 // Don't Lint, because of `None => Some(1)`
67 if x > 10 && x < 100 {
77 unsafe fn f(x: u32) -> bool {
80 let _ = Some(14).filter(|&x| unsafe { f(x) });
81 let _ = Some(15).filter(|&x| unsafe { f(x) });
83 #[allow(clippy::redundant_pattern_matching)]
84 if let Some(_) = Some(16) {
86 } else { Some(16).filter(|&x| x % 2 == 0) };
88 match Some((17, 17)) {
89 // Not linted for now could be
105 match Some(NamedTuple {
106 // Not linted for now could be
110 Some(NamedTuple { x, y }) => {
112 Some(NamedTuple { x, y })