Fix clippy lints #149

Merged
hmvp merged 1 commit from master into master 2018-04-25 21:19:46 -05:00
hmvp commented 2018-03-02 03:58:40 -06:00 (Migrated from github.com)

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 code

https://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

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 code https://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
KodrAus (Migrated from github.com) approved these changes 2018-03-02 23:26:07 -06:00
KodrAus (Migrated from github.com) left a comment

Thanks @hmvp! This looks good to me. For reference, looks like suspicious_arithmetic_impl is just about using different operations in implementations for things like Add and Subtract than the one being implemented (like using - in an impl for Add), which is why we ignore that one.

Thanks @hmvp! This looks good to me. For reference, looks like `suspicious_arithmetic_impl` is just about using different operations in implementations for things like `Add` and `Subtract` than the one being implemented (like using `-` in an impl for `Add`), which is why we ignore that one.
niklasf commented 2018-03-06 05:20:38 -06:00 (Migrated from github.com)

Regarding the implementation of Sub we should consider making clippy a bit more relaxed: https://github.com/rust-lang-nursery/rust-clippy/issues/2510

Regarding the implementation of Sub we should consider making clippy a bit more relaxed: https://github.com/rust-lang-nursery/rust-clippy/issues/2510
niklasf commented 2018-03-06 07:38:36 -06:00 (Migrated from github.com)

Update: Clippy has been adjusted rust-lang-nursery/rust-clippy#2511, so we no longer need to ignore suspicious_arithmetic_impl.

Update: Clippy has been adjusted rust-lang-nursery/rust-clippy#2511, so we no longer need to ignore `suspicious_arithmetic_impl`.
hmvp commented 2018-03-06 08:20:49 -06:00 (Migrated from github.com)

Updated the change to remove the now unneeded allow

Updated the change to remove the now unneeded allow
mulkieran commented 2018-03-16 14:58:37 -05:00 (Migrated from github.com)

It looks like clippy may have made both allows unneeded now: https://github.com/stratis-storage/devicemapper-rs/pull/287

It looks like clippy may have made both allows unneeded now: https://github.com/stratis-storage/devicemapper-rs/pull/287
niklasf commented 2018-03-16 15:07:23 -05:00 (Migrated from github.com)

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.

Yes, redundant field names are ignored in macros now: https://github.com/rust-lang-nursery/rust-clippy/commit/ed769a3bc4b39ebca5e4f5b9d8449c1cb8aa0cff. 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.
dtolnay (Migrated from github.com) approved these changes 2018-04-25 21:19:39 -05:00
dtolnay (Migrated from github.com) left a comment

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.

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.
Sign in to join this conversation.
No reviewers
No labels
bug
good first issue
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-bitflags/bitflags!149
No description provided.