File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ fn parse_cfgs<'a>(contents: &'a str) -> Vec<(usize, &'a str)> {
204
204
succeeds_non_ident && preceeds_whitespace_and_paren
205
205
} ) ;
206
206
207
- cfgs. map ( |i| {
207
+ cfgs. flat_map ( |i| {
208
208
let mut depth = 0 ;
209
209
let contents_from = & contents[ i..] ;
210
210
for ( j, byte) in contents_from. bytes ( ) . enumerate ( ) {
@@ -215,13 +215,15 @@ fn parse_cfgs<'a>(contents: &'a str) -> Vec<(usize, &'a str)> {
215
215
b')' => {
216
216
depth -= 1 ;
217
217
if depth == 0 {
218
- return ( i, & contents_from[ ..=j] ) ;
218
+ return Some ( ( i, & contents_from[ ..=j] ) ) ;
219
219
}
220
220
}
221
221
_ => { }
222
222
}
223
223
}
224
224
225
- unreachable ! ( )
225
+ // if the parentheses are unbalanced just ignore this cfg -- it'll be caught when attempting
226
+ // to run the compiler, and there's no real reason to lint it separately here
227
+ None
226
228
} ) . collect ( )
227
229
}
You can’t perform that action at this time.
0 commit comments