jam1garner / binrw

A Rust crate for helping parse and rebuild binary data using ✨macro magic✨.
https://binrw.rs
MIT License
545 stars 35 forks source link

Fix: don't warn on useless conversions when the count value is already a usize #206

Closed poliorcetics closed 1 year ago

poliorcetics commented 1 year ago

Example code to reproduce the issue: (run cargo clippy)

const LEN: usize = 42;

#[derive(binrw::BinRead)]
struct Data {
    #[br(count = LEN)]
    data: Vec<u8>,
}
csnover commented 1 year ago

Thank you for your PR, and sorry for the delay! I modified your patch slightly to add the example code as a test so this will not regress later, and to make the summary fit the convention used by this project. This will be fixed in the next release.