-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
I-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't havegood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
bool is not sufficient to keep track if we're in a constant item:
| is_in_const_item: bool, |
const A: u8 = {
const B: () = ();
let x = [0u8; 20_000_000];
x[0]
};This will still lint the array assigned to x. But if one comments out const B, it won't lint, because of the fix added in #13485
To fix this, turn the bool into a counter, increment it when entering an item and decrementing it when exiting it.
The current impl also won't prevent the lint from triggering in const fns. But I'm not sure if this is intended intended.
Originally posted by @flip1995 in #13485 (comment)
This issue has been assigned to @GnomedDev via this comment.
Metadata
Metadata
Assignees
Labels
I-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't havegood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy