Closed
Description
I tried this code:
struct Player {
hand: Vec<usize>,
}
fn main() {
let p = Player {
hand: vec![1, 2, 3, 4, 5],
};
let filter_hand = vec![5];
let new_hand: Vec<usize> = p
.hand
.iter()
.filter(|c| filter_hand.iter().find(|cc| c == cc).is_none())
.map(|c| c.clone())
.collect();
println!("Hello, world!");
}
(this is a reduced and largely nonsensical version of the real issue I hit)
With the command: cargo clippy --fix -Z unstable-options --allow-dirty
I expected to see this happen: Clippy cleanup the source code without error.
Instead, this happened: I got a rather long error message, [output.txt] attached.
Meta
rustc --version --verbose
:
% rustc --version --verbose
rustc 1.55.0-nightly (ce1d5611a 2021-06-18)
binary: rustc
commit-hash: ce1d5611a28468663e275078649e7ca6eef735a8
commit-date: 2021-06-18
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1
Backtrace
N/A; doesn't crash