如何修复 Clippy 的 needless_range_loop for 循环,该循环在具有偏移量的切片之间进行复制?

How do I fix Clippy's needless_range_loop for loops that copy between slices with an offset?

当运行 cargo clippy时,它抱怨这样的代码:

pub fn from_bytes(data: [u8; 72]) -> Stuff {
    let mut ts = [0u8; 8];
    let mut cs = [0u8; 64];

    for b in 0..8 {
        ts[b] = data[b];
    }

    for bb in 0..64 {
        cs[bb] = data[bb + 8];
    }
}

warning: the loop variable `bb` is used to index `cs`
  --> src/main.rs:9:5
   |
9  | /     for bb in 0..64 {
10 | |         cs[bb] = data[bb + 8];
11 | |     }
   | |_____^
   |
   = note: #[warn(needless_range_loop)] on by default
   = help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_range_loop
help: consider using an iterator
   |     for (bb, <item>) in cs.iter().enumerate().take(64) {

我无法理解这个 information。如何更改为建议的方法?我不明白

for (bb, <item>) in cs.iter().enumerate().take(64)

可以应用于我的用例。

使用clone_from_slice

ts.clone_from_slice(&data[..8]);
cs.clone_from_slice(&data[8..]);