rust/src/docs/skip_while_next.txt
2022-09-09 13:36:26 +02:00

16 lines
No EOL
283 B
Text

### What it does
Checks for usage of `_.skip_while(condition).next()`.
### Why is this bad?
Readability, this can be written more concisely as
`_.find(!condition)`.
### Example
```
vec.iter().skip_while(|x| **x == 0).next();
```
Use instead:
```
vec.iter().find(|x| **x != 0);
```