-
Couldn't load subscription status.
- Fork 1.8k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-nurseryLint: Currently in the nursery groupLint: Currently in the nursery group
Description
Summary
Due to a lifetime issue, the suggestion doesn't compile.
Reproducer
fn foo() {
let mut current = vec![];
while !current.is_empty() {
current.drain(..).for_each(|_: ()| {});
}
}becomes
fn foo() {
let mut current = vec![];
while !current.is_empty() { // borrow of moved value: `current`
current.into_iter().for_each(|_: ()| {});
}
}Version
rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: x86_64-unknown-linux-gnu
release: 1.87.0
LLVM version: 20.1.1
Additional Labels
@rustbot I-suggestion-causes-error
spearman
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-nurseryLint: Currently in the nursery groupLint: Currently in the nursery group