]> git.lizzy.rs Git - rust.git/blob - tests/ui/manual_filter.stderr
Auto merge of #9622 - llogiq:box-dyn-default, r=Alexendoo
[rust.git] / tests / ui / manual_filter.stderr
1 error: manual implementation of `Option::filter`
2   --> $DIR/manual_filter.rs:7:5
3    |
4 LL | /     match Some(0) {
5 LL | |         None => None,
6 LL | |         Some(x) => {
7 LL | |             if x > 0 {
8 ...  |
9 LL | |         },
10 LL | |     };
11    | |_____^ help: try this: `Some(0).filter(|&x| x <= 0)`
12    |
13    = note: `-D clippy::manual-filter` implied by `-D warnings`
14
15 error: manual implementation of `Option::filter`
16   --> $DIR/manual_filter.rs:18:5
17    |
18 LL | /     match Some(1) {
19 LL | |         Some(x) => {
20 LL | |             if x > 0 {
21 LL | |                 None
22 ...  |
23 LL | |         None => None,
24 LL | |     };
25    | |_____^ help: try this: `Some(1).filter(|&x| x <= 0)`
26
27 error: manual implementation of `Option::filter`
28   --> $DIR/manual_filter.rs:29:5
29    |
30 LL | /     match Some(2) {
31 LL | |         Some(x) => {
32 LL | |             if x > 0 {
33 LL | |                 None
34 ...  |
35 LL | |         _ => None,
36 LL | |     };
37    | |_____^ help: try this: `Some(2).filter(|&x| x <= 0)`
38
39 error: manual implementation of `Option::filter`
40   --> $DIR/manual_filter.rs:40:5
41    |
42 LL | /     match Some(3) {
43 LL | |         Some(x) => {
44 LL | |             if x > 0 {
45 LL | |                 Some(x)
46 ...  |
47 LL | |         None => None,
48 LL | |     };
49    | |_____^ help: try this: `Some(3).filter(|&x| x > 0)`
50
51 error: manual implementation of `Option::filter`
52   --> $DIR/manual_filter.rs:52:5
53    |
54 LL | /     match y {
55 LL | |         // Some(4)
56 LL | |         None => None,
57 LL | |         Some(x) => {
58 ...  |
59 LL | |         },
60 LL | |     };
61    | |_____^ help: try this: `y.filter(|&x| x <= 0)`
62
63 error: manual implementation of `Option::filter`
64   --> $DIR/manual_filter.rs:64:5
65    |
66 LL | /     match Some(5) {
67 LL | |         Some(x) => {
68 LL | |             if x > 0 {
69 LL | |                 Some(x)
70 ...  |
71 LL | |         _ => None,
72 LL | |     };
73    | |_____^ help: try this: `Some(5).filter(|&x| x > 0)`
74
75 error: manual implementation of `Option::filter`
76   --> $DIR/manual_filter.rs:75:5
77    |
78 LL | /     match Some(6) {
79 LL | |         Some(ref x) => {
80 LL | |             if x > &0 {
81 LL | |                 Some(x)
82 ...  |
83 LL | |         _ => None,
84 LL | |     };
85    | |_____^ help: try this: `Some(6).as_ref().filter(|&x| x > &0)`
86
87 error: manual implementation of `Option::filter`
88   --> $DIR/manual_filter.rs:87:5
89    |
90 LL | /     match Some(String::new()) {
91 LL | |         Some(x) => {
92 LL | |             if external_cond {
93 LL | |                 Some(x)
94 ...  |
95 LL | |         _ => None,
96 LL | |     };
97    | |_____^ help: try this: `Some(String::new()).filter(|x| external_cond)`
98
99 error: manual implementation of `Option::filter`
100   --> $DIR/manual_filter.rs:98:5
101    |
102 LL | /     if let Some(x) = Some(7) {
103 LL | |         if external_cond { Some(x) } else { None }
104 LL | |     } else {
105 LL | |         None
106 LL | |     };
107    | |_____^ help: try this: `Some(7).filter(|&x| external_cond)`
108
109 error: manual implementation of `Option::filter`
110   --> $DIR/manual_filter.rs:104:5
111    |
112 LL | /     match &Some(8) {
113 LL | |         &Some(x) => {
114 LL | |             if x != 0 {
115 LL | |                 Some(x)
116 ...  |
117 LL | |         _ => None,
118 LL | |     };
119    | |_____^ help: try this: `Some(8).filter(|&x| x != 0)`
120
121 error: manual implementation of `Option::filter`
122   --> $DIR/manual_filter.rs:115:5
123    |
124 LL | /     match Some(9) {
125 LL | |         Some(x) => {
126 LL | |             if x > 10 && x < 100 {
127 LL | |                 Some(x)
128 ...  |
129 LL | |         None => None,
130 LL | |     };
131    | |_____^ help: try this: `Some(9).filter(|&x| x > 10 && x < 100)`
132
133 error: manual implementation of `Option::filter`
134   --> $DIR/manual_filter.rs:141:5
135    |
136 LL | /     match Some(11) {
137 LL | |         // Lint, statement is preserved by `.filter`
138 LL | |         Some(x) => {
139 LL | |             if {
140 ...  |
141 LL | |         None => None,
142 LL | |     };
143    | |_____^
144    |
145 help: try this
146    |
147 LL ~     Some(11).filter(|&x| {
148 LL +                 println!("foo");
149 LL +                 x > 10 && x < 100
150 LL ~             });
151    |
152
153 error: manual implementation of `Option::filter`
154   --> $DIR/manual_filter.rs:185:13
155    |
156 LL |       let _ = match Some(14) {
157    |  _____________^
158 LL | |         Some(x) => {
159 LL | |             if unsafe { f(x) } {
160 LL | |                 Some(x)
161 ...  |
162 LL | |         None => None,
163 LL | |     };
164    | |_____^ help: try this: `Some(14).filter(|&x| unsafe { f(x) })`
165
166 error: manual implementation of `Option::filter`
167   --> $DIR/manual_filter.rs:195:13
168    |
169 LL |       let _ = match Some(15) {
170    |  _____________^
171 LL | |         Some(x) => unsafe {
172 LL | |             if f(x) { Some(x) } else { None }
173 LL | |         },
174 LL | |         None => None,
175 LL | |     };
176    | |_____^ help: try this: `Some(15).filter(|&x| unsafe { f(x) })`
177
178 error: manual implementation of `Option::filter`
179   --> $DIR/manual_filter.rs:205:12
180    |
181 LL |       } else if let Some(x) = Some(16) {
182    |  ____________^
183 LL | |         // Lint starting from here
184 LL | |         if x % 2 == 0 { Some(x) } else { None }
185 LL | |     } else {
186 LL | |         None
187 LL | |     };
188    | |_____^ help: try this: `{ Some(16).filter(|&x| x % 2 == 0) }`
189
190 error: aborting due to 15 previous errors
191