Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

while_let_on_iterator false positive with nested loop #1438

Closed
sinkuu opened this issue Jan 13, 2017 · 1 comment
Closed

while_let_on_iterator false positive with nested loop #1438

sinkuu opened this issue Jan 13, 2017 · 1 comment

Comments

@sinkuu
Copy link
Contributor

sinkuu commented Jan 13, 2017

fn main() {
    let mut it = 1..100;

    for _ in 0..10 { // or any other loop
        while let Some(x) = it.next() { // (false positive) this loop could be written as a `for` loop
        }
    }
}

while_let_on_iterator lint should ignore a while let Some(x) = iterator_variable_external_to_loop within a loop, because iterators cannot be consumed there.

@sinkuu
Copy link
Contributor Author

sinkuu commented Jan 13, 2017

@sinkuu sinkuu closed this as completed Jan 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant