explicit_counter_loop produces incorrect advice #4677
Labels
C-bug
Category: Clippy is not doing the correct thing
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
Using clippy 0.0.212 (3aea860 2019-09-03), consider the following function (which was reduced from a larger function
Clippy suggests:
However, it isn't that simple, as
l
is used both before, and after incrementing. This might be OK, because just doing the suggested fix isn't enough anyway, so someone should hopefully notice what's going on. The other option would be to only suggest this if there is no further usage of the loop variable after it is incremented.The text was updated successfully, but these errors were encountered: