-
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 haveI-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 applied
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
cargo clippy -V: e.g. clippy 0.0.212 (f455e46 2020-06-20)rustc -Vv:
% cargo clippy -V
clippy 0.1.54 (ce1d561 2021-06-18)
% rustc -Vv
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, no crash
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 haveI-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 applied