-
Notifications
You must be signed in to change notification settings - Fork 2k
explicit_counter_loop improvement suggestion #1670
Copy link
Copy link
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestionsT-middleType: Probably requires verifiying typesType: Probably requires verifiying typesgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestionsT-middleType: Probably requires verifiying typesType: Probably requires verifiying typesgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Type
Fields
Give feedbackNo fields configured for issues without a type.
Hello! I'm just learning rust and clippy has been a valuable resource for improving my code, thanks!
Today I got confused by one of the clippy suggestions.
I had a look at the source but not sure how to implement proposed improvements.
Consider the following
clippy gives the following warning:
attempting to rework the code as suggested:
... does not compile:
Eventually I realized I just need to wrap the min..max in parenthesis to solve it.
I feel an improved error message in check_for_loop_explicit_counter could look like this:
Also it hardcodes "item" rather than using the variable name "i"