-
Notifications
You must be signed in to change notification settings - Fork 2k
FP mut_range_bound: range bound modified inside enclosing loop #6072
Copy link
Copy link
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingE-hardCall for participation: This a hard problem and requires more experience or effort to work onCall for participation: This a hard problem and requires more experience or effort to work onI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingE-hardCall for participation: This a hard problem and requires more experience or effort to work onCall for participation: This a hard problem and requires more experience or effort to work onI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Type
Fields
Give feedbackNo fields configured for issues without a type.
In this code we first create the mut range bound, and mutate it in another loop which means the loop that actually uses the range is executed several times with different bounds (even if it is true that inside the usage of the range, changing the index has no effect on the inner loop.
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=30343889f1b8be663adb15c2d8184c2a
The lint should probably only fire if range bound variable and the range bounds usage are in the same scope?
Meta
clippy 0.0.212 (1fd5b9d 2020-09-20)