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!.
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 theusingtry!
macro andptr::offset
instead ofptr::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!
.