-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messages
Description
I tried this code:
fn main()
{
let mut block: [u8; 40] = [0; 40];
let type_ext: [u8; 16] = [0; 16];
for i in 24..40 {
block[i] = type_ext[i - 24];
}
}
I expected to see this happen: Clippy finding fix block[24..40].copy_from_slice(&type_ext)
Instead, this happened: Clippy suggests less clear form: block[24..40].clone_from_slice(&type_ext[..(40 - 24)]);
I suppose clippy did not find that type_ext is 16 u8 and not more.
Meta
Rust version (rustc -Vv
):
rustc 1.56.0 (09c42c458 2021-10-18)
binary: rustc
commit-hash: 09c42c45858d5f3aedfa670698275303a3d19afa
commit-date: 2021-10-18
host: x86_64-unknown-linux-gnu
release: 1.56.0
LLVM version: 13.0.0
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messages