-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
manual_memcpy false positive #9334
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Comments
ViridiFox
added
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
labels
Aug 14, 2022
rustbot
added
the
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
label
Aug 14, 2022
A similar false positive is triggered by a situation in reverse. fn main() {
let mut m2d = vec![vec![0; 10]; 10];
let mut m1d = vec![0; 10];
for i in 0..10 {
m1d[i] = m2d[i][i];
}
for i in 0..10 {
m2d[i][i] = m1d[i];
}
}
Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=bc438205758c5e8f5caf6f4707a76533 |
@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
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
Copying the diagonal from a 2d Matrix/Vec to a 1d Vec gives the false positive that it can be replaced by a
copy_from_slice
.Lint Name
manual_memcpy
Reproducer
the minimal code:
gives the warning:
Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: