Skip to content

Add write and read methods to Parameters #137

Add write and read methods to Parameters

Add write and read methods to Parameters #137

GitHub Actions / clippy succeeded Dec 26, 2023 in 1s

clippy

98 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 98
Note 0
Help 0

Versions

  • rustc 1.74.1 (a28077b28 2023-12-04)
  • cargo 1.74.1 (ecb9851af 2023-10-18)
  • clippy 0.1.74 (a28077b 2023-12-04)

Annotations

Check warning on line 149 in fawkes-crypto/src/native/poseidon.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `Num<Fr>` which implements the `Copy` trait

warning: using `clone` on type `Num<Fr>` which implements the `Copy` trait
   --> fawkes-crypto/src/native/poseidon.rs:149:5
    |
149 |     state[0].clone()
    |     ^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `state[0]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Check warning on line 146 in fawkes-crypto/src/native/poseidon.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `Num<Fr>` which implements the `Copy` trait

warning: using `clone` on type `Num<Fr>` which implements the `Copy` trait
   --> fawkes-crypto/src/native/poseidon.rs:146:57
    |
146 |             state[i] = poseidon(&[state[2 * i].clone(), state[2 * i + 1].clone()], params);
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `state[2 * i + 1]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Check warning on line 146 in fawkes-crypto/src/native/poseidon.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `Num<Fr>` which implements the `Copy` trait

warning: using `clone` on type `Num<Fr>` which implements the `Copy` trait
   --> fawkes-crypto/src/native/poseidon.rs:146:35
    |
146 |             state[i] = poseidon(&[state[2 * i].clone(), state[2 * i + 1].clone()], params);
    |                                   ^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `state[2 * i]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Check warning on line 126 in fawkes-crypto/src/native/poseidon.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `Num<Fr>` which implements the `Copy` trait

warning: using `clone` on type `Num<Fr>` which implements the `Copy` trait
   --> fawkes-crypto/src/native/poseidon.rs:126:20
    |
126 |     let mut root = leaf.clone();
    |                    ^^^^^^^^^^^^ help: try removing the `clone` call: `leaf`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Check warning on line 106 in fawkes-crypto/src/native/poseidon.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

explicit call to `.into_iter()` in function argument accepting `IntoIterator`

warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   --> fawkes-crypto/src/native/poseidon.rs:106:30
    |
106 |         state.iter_mut().zip(c.into_iter()).for_each(|(l, r)| *l+=*r);
    |                              ^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `c`
    |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   --> /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/iter/traits/iterator.rs:642:12
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

Check warning on line 96 in fawkes-crypto/src/native/poseidon.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression borrows a value the compiler would automatically borrow

warning: this expression borrows a value the compiler would automatically borrow
  --> fawkes-crypto/src/native/poseidon.rs:96:5
   |
96 |     (&mut state[0..n_inputs]).clone_from_slice(inputs);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `state[0..n_inputs]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 78 in fawkes-crypto/src/native/poseidon.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the loop variable `j` is only used to index `state`

warning: the loop variable `j` is only used to index `state`
  --> fawkes-crypto/src/native/poseidon.rs:78:22
   |
78 |             for j in 0..params.t {
   |                      ^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator
   |
78 |             for <item> in state.iter_mut().take(params.t) {
   |                 ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 64 in fawkes-crypto/src/native/poseidon.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the loop variable `j` is used to index `state`

warning: the loop variable `j` is used to index `state`
  --> fawkes-crypto/src/native/poseidon.rs:64:18
   |
64 |         for j in 0..statelen {
   |                  ^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
   |
64 |         for (j, <item>) in state.iter().enumerate().take(statelen) {
   |             ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 63 in fawkes-crypto/src/native/poseidon.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the loop variable `i` is used to index `new_state`

warning: the loop variable `i` is used to index `new_state`
  --> fawkes-crypto/src/native/poseidon.rs:63:14
   |
63 |     for i in 0..statelen {
   |              ^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
   |
63 |     for (i, <item>) in new_state.iter_mut().enumerate().take(statelen) {
   |         ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 276 in fawkes-crypto/src/native/ecc.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `EdwardsPointEx<Fr>` which implements the `Copy` trait

warning: using `clone` on type `EdwardsPointEx<Fr>` which implements the `Copy` trait
   --> fawkes-crypto/src/native/ecc.rs:276:21
    |
276 |         let mut p = self.clone();
    |                     ^^^^^^^^^^^^ help: try dereferencing it: `*self`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Check warning on line 371 in /home/runner/work/fawkes-crypto/fawkes-crypto/ff-uint/src/uint/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

manual `RangeInclusive::contains` implementation

warning: manual `RangeInclusive::contains` implementation
  --> fawkes-crypto/src/engines/mod.rs:10:1
   |
10 | / construct_uint! {
11 | |     struct _U384(6);
12 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
   = note: this warning originates in the macro `construct_uint` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 371 in /home/runner/work/fawkes-crypto/fawkes-crypto/ff-uint/src/uint/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

manual `RangeInclusive::contains` implementation

warning: manual `RangeInclusive::contains` implementation
 --> fawkes-crypto/src/engines/mod.rs:6:1
  |
6 | / construct_uint! {
7 | |     struct _U256(4);
8 | | }
  | |_^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
  = note: `#[warn(clippy::manual_range_contains)]` on by default
  = note: this warning originates in the macro `construct_uint` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 71 in fawkes-crypto/src/engines/bn256/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you should consider adding a `Default` implementation for `JubJubBN256`

warning: you should consider adding a `Default` implementation for `JubJubBN256`
  --> fawkes-crypto/src/engines/bn256/mod.rs:49:5
   |
49 | /     pub fn new() -> Self {
50 | |         let edwards_d = -Num::from(168696) / Num::from(168700);
51 | |
52 | |         let montgomery_a = Num::from(2) * (Num::ONE - edwards_d) / (Num::ONE + edwards_d);
...  |
70 | |         }
71 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
   |
48 + impl Default for JubJubBN256 {
49 +     fn default() -> Self {
50 +         Self::new()
51 +     }
52 + }
   |

Check warning on line 36 in fawkes-crypto/src/engines/bn256/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7)
  --> fawkes-crypto/src/engines/bn256/mod.rs:28:1
   |
28 | / construct_primefield_params! {
29 | |     pub struct Fs(super::U256);
30 | |
31 | |     impl PrimeFieldParams for Fs {
...  |
35 | |    }
36 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
   = note: this warning originates in the macro `construct_primefield_params` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 26 in fawkes-crypto/src/engines/bn256/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7)
  --> fawkes-crypto/src/engines/bn256/mod.rs:18:1
   |
18 | / construct_primefield_params! {
19 | |     pub struct Fr(super::U256);
20 | |
21 | |     impl PrimeFieldParams for Fr {
...  |
25 | |    }
26 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
   = note: this warning originates in the macro `construct_primefield_params` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 16 in fawkes-crypto/src/engines/bn256/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7)
  --> fawkes-crypto/src/engines/bn256/mod.rs:8:1
   |
8  | / construct_primefield_params! {
9  | |     pub struct Fq(super::U256);
10 | |
11 | |     impl PrimeFieldParams for Fq {
...  |
15 | |    }
16 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
   = note: this warning originates in the macro `construct_primefield_params` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 71 in fawkes-crypto/src/engines/bls12_381/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you should consider adding a `Default` implementation for `JubJubBLS12_381`

warning: you should consider adding a `Default` implementation for `JubJubBLS12_381`
  --> fawkes-crypto/src/engines/bls12_381/mod.rs:49:5
   |
49 | /     pub fn new() -> Self {
50 | |         let edwards_d = -Num::from(10240) / Num::from(10241);
51 | |
52 | |         let montgomery_a = Num::from(2) * (Num::ONE - edwards_d) / (Num::ONE + edwards_d);
...  |
70 | |         }
71 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
   = note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
   |
48 + impl Default for JubJubBLS12_381 {
49 +     fn default() -> Self {
50 +         Self::new()
51 +     }
52 + }
   |

Check warning on line 36 in fawkes-crypto/src/engines/bls12_381/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7)
  --> fawkes-crypto/src/engines/bls12_381/mod.rs:28:1
   |
28 | / construct_primefield_params! {
29 | |     pub struct Fs(super::U256);
30 | |
31 | |     impl PrimeFieldParams for Fs {
...  |
35 | |    }
36 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
   = note: this warning originates in the macro `construct_primefield_params` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 26 in fawkes-crypto/src/engines/bls12_381/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7)
  --> fawkes-crypto/src/engines/bls12_381/mod.rs:18:1
   |
18 | / construct_primefield_params! {
19 | |     pub struct Fr(super::U256);
20 | |
21 | |     impl PrimeFieldParams for Fr {
...  |
25 | |    }
26 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
   = note: this warning originates in the macro `construct_primefield_params` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 16 in fawkes-crypto/src/engines/bls12_381/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (12/7)

warning: this function has too many arguments (12/7)
  --> fawkes-crypto/src/engines/bls12_381/mod.rs:8:1
   |
8  | / construct_primefield_params! {
9  | |     pub struct Fq(super::U384);
10 | |
11 | |     impl PrimeFieldParams for Fq {
...  |
15 | |    }
16 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
   = note: this warning originates in the macro `construct_primefield_params` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 84 in fawkes-crypto/src/core/sizedvec.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression borrows a value the compiler would automatically borrow

warning: this expression borrows a value the compiler would automatically borrow
  --> fawkes-crypto/src/core/sizedvec.rs:84:27
   |
84 |         SizedVec(unsafe { (&*(&MaybeUninit::new(data) as *const _ as *const MaybeUninit<_>)).assume_init_read() })
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `(*(&MaybeUninit::new(data) as *const _ as *const MaybeUninit<_>))`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 78 in fawkes-crypto/src/core/sizedvec.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the loop variable `i` is only used to index `data`

warning: the loop variable `i` is only used to index `data`
  --> fawkes-crypto/src/core/sizedvec.rs:78:18
   |
78 |         for i in 0..L {
   |                  ^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator
   |
78 |         for <item> in data.iter_mut().take(L) {
   |             ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 76 in fawkes-crypto/src/circuit/poseidon.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

explicit call to `.into_iter()` in function argument accepting `IntoIterator`

warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
  --> fawkes-crypto/src/circuit/poseidon.rs:76:30
   |
76 |         state.iter_mut().zip(c.into_iter()).for_each(|(l, r)| *l+=r);
   |                              ^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `c`
   |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
  --> /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/iter/traits/iterator.rs:642:12
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
   = note: `#[warn(clippy::useless_conversion)]` on by default

Check warning on line 64 in fawkes-crypto/src/circuit/poseidon.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression borrows a value the compiler would automatically borrow

warning: this expression borrows a value the compiler would automatically borrow
  --> fawkes-crypto/src/circuit/poseidon.rs:64:5
   |
64 |     (&mut state[0..n_inputs]).clone_from_slice(inputs);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `state[0..n_inputs]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 45 in fawkes-crypto/src/circuit/poseidon.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the loop variable `j` is only used to index `state`

warning: the loop variable `j` is only used to index `state`
  --> fawkes-crypto/src/circuit/poseidon.rs:45:22
   |
45 |             for j in 0..params.t {
   |                      ^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator
   |
45 |             for <item> in state.iter_mut().take(params.t) {
   |                 ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~