rust-lang/rust-clippy

`never_loop`: Note why the loop will never loop.

Open

#16 056 ouverte le 9 nov. 2025

Voir sur GitHub
 (7 commentaires) (0 réactions) (1 assigné)Rust (1 391 forks)batch import
C-enhancementgood first issue

Métriques du dépôt

Stars
 (10 406 stars)
Métriques de merge PR
 (Merge moyen 16j 6h) (79 PRs mergées en 30 j)

Description

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

Guide contributeur