Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy warnings #17

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Fix clippy warnings #17

wants to merge 6 commits into from

Conversation

LingMan
Copy link
Contributor

@LingMan LingMan commented Oct 21, 2020

This fixes most clippy warnings in this crate. Might want to make sure that No need to check if a u64 is less than zero and Remove unused constant K6 are actually just removing remnants and aren't indications of real bugs.

Note that this is based on my earlier 2018 edition PR. I'll rebase once that gets merged.

Fixes clippy warnings such as:

warning: unneeded `return` statement
  --> src/combine.rs:13:5
   |
13 |     return sum;
   |     ^^^^^^^^^^^ help: remove `return`: `sum`
   |
   = note: `#[warn(clippy::needless_return)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
Fixes clippy error:

error: useless lint attribute
  --> src/lib.rs:27:1
   |
27 | #[deny(missing_docs)]
   | ^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![deny(missing_docs)]`
   |
   = note: `#[deny(clippy::useless_attribute)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_attribute
Fixes clippy error:

error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
  --> src/combine.rs:28:8
   |
28 |     if len2 <= 0 {
   |        ^^^^^^^^^
   |
   = note: `#[deny(clippy::absurd_extreme_comparisons)]` on by default
   = help: because `0` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `len2 == 0` instead
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#absurd_extreme_comparisons
It only ever got dropped, which does nothing for types implementing Copy
Fixes clippy error:

error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact.
   --> src/specialized/pclmulqdq.rs:147:5
    |
147 |     drop(K6);
    |     ^^^^^^^^
    |
    = note: `#[deny(clippy::drop_copy)]` on by default
note: argument has type i64
   --> src/specialized/pclmulqdq.rs:147:10
    |
147 |     drop(K6);
    |          ^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#drop_copy
Fixes clippy warning:

warning: the loop variable `n` is only used to index `odd`.
  --> src/combine.rs:35:14
   |
35 |     for n in 1..GF2_DIM {
   |              ^^^^^^^^^^
   |
   = note: `#[warn(clippy::needless_range_loop)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator
   |
35 |     for <item> in odd.iter_mut().take(GF2_DIM).skip(1) {
   |         ^^^^^^    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant