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
Report for loops using iter() and iter_mut() unnecesarily #10683
Comments
Since I was touching the "places where the return value of |
That shouldn't be possible, no. |
think I may be close on defining the rule and the test cases, but stuck on why the tests are failing when I don't expect them to. see commit in my branch aeischeid@57f5483 |
I'm removing the easy label, since this can't be fixed straightaway (given the conclusion we've arrived at #11116). Maybe we should have a todo list in the issue mentioning which types need the |
We have some types that have an |
Rust allows using
for foo in &bar
instead offor foo in bar.iter()
, andfor foo in &mut bar
instead offor foo in bar.iter_mut()
. Let's add a check tocheck_rust
that warns about instances of.iter()
and.iter_mut()
that could be replaced. There are a lot of existing instances of this pattern that will need replacing, too.Note: patterns like
for foo in bar.iter().enumerate()
(ie. places where the return value ofiter()
is further refined) cannot be replaced and shouldn't be reported.Code:
python/tidy/servo_tidy/tidy.py
Tests: add a test to
python/tidy/servo_tidy_tests/test_tidy.py
and run it via./mach test-tidy --self-test
The text was updated successfully, but these errors were encountered: