rust-lang/rust-clippy
Auf GitHub ansehen`never_loop`: Note why the loop will never loop.
Open
#16.056 geöffnet am 9. Nov. 2025
C-enhancementgood first issue
Repository-Metriken
- Stars
- (10.406 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 16T 6h) (79 gemergte PRs in 30 T)
Beschreibung
Description
The reason why a loop will never actually complete isn't always obvious (see #16054 for an example). For such cases it would be nice to have a note pointing out all the locations where this occurs. Obvious causes ideally wouldn't get any additional output.
Examples
loop {
do_something();
// No need to point this out.
panic!();
}
// Imagine something less obvious.
let x = || Some(panic!());
loop {
// Why doesn't this loop?
x().unwrap();
}
Version
Additional Labels
No response