Fix clippy lints #149
Loading…
Reference in a new issue
No description provided.
Delete branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The docs are not yet published for the latest clippy but this pull request fixes two clippy warnings you get when using
bitflags!in your codehttps://rust-lang-nursery.github.io/rust-clippy/v0.0.187/index.html#redundant_field_names
https://rust-lang-nursery.github.io/rust-clippy/v0.0.187/index.html#suspicious_arithmetic_impl
Thanks @hmvp! This looks good to me. For reference, looks like
suspicious_arithmetic_implis just about using different operations in implementations for things likeAddandSubtractthan the one being implemented (like using-in an impl forAdd), which is why we ignore that one.Regarding the implementation of Sub we should consider making clippy a bit more relaxed: https://github.com/rust-lang-nursery/rust-clippy/issues/2510
Update: Clippy has been adjusted rust-lang-nursery/rust-clippy#2511, so we no longer need to ignore
suspicious_arithmetic_impl.Updated the change to remove the now unneeded allow
It looks like clippy may have made both allows unneeded now: https://github.com/stratis-storage/devicemapper-rs/pull/287
Yes, redundant field names are ignored in macros now:
github.com/rust-lang-nursery/rust-clippy@ed769a3bc4.We should still commit this small cleanup. It's not a breaking change because the shorthand syntax was stabilized in Rust 1.17 and bitflags already requires 1.20.
Thanks! Indeed this is a nice cleanup whether or not it still triggers Clippy, and our minimum supported Rust version of 1.20.0 should be fine with the field init shorthand syntax.