File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 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)> {
204204 succeeds_non_ident && preceeds_whitespace_and_paren
205205 } ) ;
206206
207- cfgs. map ( |i| {
207+ cfgs. flat_map ( |i| {
208208 let mut depth = 0 ;
209209 let contents_from = & contents[ i..] ;
210210 for ( j, byte) in contents_from. bytes ( ) . enumerate ( ) {
@@ -215,13 +215,15 @@ fn parse_cfgs<'a>(contents: &'a str) -> Vec<(usize, &'a str)> {
215215 b')' => {
216216 depth -= 1 ;
217217 if depth == 0 {
218- return ( i, & contents_from[ ..=j] ) ;
218+ return Some ( ( i, & contents_from[ ..=j] ) ) ;
219219 }
220220 }
221221 _ => { }
222222 }
223223 }
224224
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
226228 } ) . collect ( )
227229}
You can’t perform that action at this time.
0 commit comments