rust-lang / rust-lang/rust-clippy
clippy::never_loop: never loop is usefull when has break 'out
Open
Nobody has claimed this yet.
S-triage
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Description
this never loop is usefull when has break 'out
#[allow(clippy::never_loop)]
'out: loop {
for (i, c) in chars.by_ref() {
if c == '\n' || c == '\r' {
continue;
}
start = i;
break 'out;
}
start = sub.len();
break;
}
this will set start to sub.len() if sub not contains "\r" or "\n"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Rust snippet from the issue and checking how clippy::never_loop handles the labeled break. Read the lint's existing implementation and tests if available in the repository. Done means the shown loop is no longer incorrectly reported as never looping while genuine never-loop cases remain covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100