-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Lint on loop { continue }
#7417
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
good-first-issue
These issues are a good way to get started with Clippy
Comments
Is there the related PR or discussion? Just wondering. |
The PRs fixing this are probably linked from somewhere in rust-lang/rust#28728 |
This can be an enhancement of |
bors
added a commit
that referenced
this issue
Jul 26, 2021
Enhance needless continue to detect loop {continue;} Fixes #7417 changelog: Report [`needless_continue`] in `loop { continue; }` case
bors
added a commit
that referenced
this issue
Jul 26, 2021
Enhance needless continue to detect loop {continue;} Fixes #7417 changelog: Report [`needless_continue`] in `loop { continue; }` case
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
good-first-issue
These issues are a good way to get started with Clippy
What it does
loop { continue }
is heavily used in the embedded ecosystem to sidestep an LLVM miscompilation. However, nowadays it results in the same MIR and thus LLVM IR asloop {}
, and the miscompilation ofloop {}
has been fixed, so this is unnecessary.Categories (optional)
clippy::style
probably, since it's just a confusing way to writeloop {}
What is the advantage of the recommended code over the original code
Looks clearer
Drawbacks
None.
Linting on macros that expand to
continue;
should probably be avoided though.Example
Could be written as:
The text was updated successfully, but these errors were encountered: