Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FN: iter_cloned_collect with a large array #6808

Closed
Y-Nak opened this issue Feb 27, 2021 · 1 comment · Fixed by #7138
Closed

FN: iter_cloned_collect with a large array #6808

Y-Nak opened this issue Feb 27, 2021 · 1 comment · Fixed by #7138
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@Y-Nak
Copy link
Contributor

Y-Nak commented Feb 27, 2021

Lint name: iter_cloned_collect

I tried this code:

let arr: [u8; 64] = [0; 64];
let v: Vec<_> = arr.iter().cloned().collect();

I expected to see this happened: iter_cloned_collect is triggered.

Instead, this happened: nothing.

Meta

  • cargo clippy -V: clippy 0.0.212 (cb75ad5 2021-02-10)
  • rustc -Vv:
rustc 1.50.0 (cb75ad5db 2021-02-10)
binary: rustc
commit-hash: cb75ad5db02783e8b0222fee363c5f63f7e2cf5b
commit-date: 2021-02-10
host: x86_64-unknown-linux-gnu
release: 1.50.0

I think this is caused by derefs_to_slice and I suppose we should use expr_ty_adjusted instead of may_slice to handle coercion in the function.

@Y-Nak Y-Nak added C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't labels Feb 27, 2021
@Y-Nak Y-Nak changed the title FN: ITER_CLONED_COLLECT with a large array. FN: iter_cloned_collect with a large array. Feb 27, 2021
@Y-Nak Y-Nak changed the title FN: iter_cloned_collect with a large array. FN: iter_cloned_collect with a large array Feb 27, 2021
@camsteffen camsteffen added the good-first-issue These issues are a good way to get started with Clippy label Mar 2, 2021
@mgacek8
Copy link
Contributor

mgacek8 commented Apr 26, 2021

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants