BurntSushi / byteorder

Rust library for reading/writing numbers in big-endian and little-endian.
The Unlicense
981 stars 143 forks source link

Resolve clippy warnings in normal build #157

Closed zrneely closed 4 years ago

zrneely commented 4 years ago

These changes fix a few cases where byteorder invokes undefined behavior (caught by clippy) by dereferencing a possibly unaligned pointer (see here).

While I was doing that, I additionally cleaned up the other clippy warnings around the use of the try! macro and using ptr::offset instead of ptr::add.

IMO the only important changes here are the fixes to the UB, so I'm happy to revert the other changes and open a different PR with them (or just forget about them), if you'd prefer.

Edit: I should have looked at the Travis config - looks like 1.12 is the minimum Rust version, so I've reverted my proposed changes around use of try!.

BurntSushi commented 4 years ago

Thanks! I merged this manually because the commits were not organized. In the process, I forgot to carry over your author info. Sorry. :-(