-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Lint name: clippy::while_let_loop
I tried this code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=6e0c751f49cce697e1f06bcc1fed429e
I simplify it by changing instances to only 5, and "work" to just short sleep
to run better on playground, but I have 32 core CPU, so using more than one core at time is important for me.
loop {
// lock mutex to obtain next thing to process, and unlock it before processing it
let seed = if let Some(seed) = seeds.lock().unwrap().pop_front() {
seed
} else {
break
};
// do something
}
I expected to see this happen: no lint, or suggestion that does not break the code
Instead, this happened: suggested code is running one thread at time, instead of many, which is significant performance impact.
Meta
Rust version (rustc -Vv
):
rustc 1.58.0-nightly (29b124802 2021-10-25)
binary: rustc
commit-hash: 29b1248025b19bd132c8047fc710ea9314b9b76b
commit-date: 2021-10-25
host: x86_64-pc-windows-msvc
release: 1.58.0-nightly
LLVM version: 13.0.0
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have