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

make lib komodefi compatible #8

Merged
merged 43 commits into from
Nov 7, 2023

fix review notes

1b20142
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

make lib komodefi compatible #8

fix review notes
1b20142
Select commit
Loading
Failed to load commit list.
This check has been archived and is scheduled for deletion. Learn more about checks retention
GitHub Actions / Clippy (nightly) succeeded Nov 1, 2023 in 4s

Clippy (nightly)

218 warnings

Details

Results

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

Versions

  • rustc 1.75.0-nightly (9d83ac217 2023-10-31)
  • cargo 1.75.0-nightly (b4d18d4bd 2023-10-31)
  • clippy 0.1.75 (9d83ac2 2023-10-31)

Annotations

Check warning on line 163 in zcash_proofs/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits
   --> zcash_proofs/src/lib.rs:163:37
    |
163 |         VerifyingKey::<Bls12>::read(&mut fs)
    |                                     ^^^^^^^ help: change this to: `fs`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
    = note: `-W clippy::needless-borrows-for-generic-args` implied by `-W clippy::all`
    = help: to override `-W clippy::all` add `#[allow(clippy::needless_borrows_for_generic_args)]`

Check warning on line 161 in zcash_proofs/src/sapling/verifier.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

this expression borrows a value the compiler would automatically borrow

warning: this expression borrows a value the compiler would automatically borrow
   --> zcash_proofs/src/sapling/verifier.rs:161:9
    |
161 |         (&mut data_to_be_signed[32..64]).copy_from_slice(&sighash_value[..]);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `data_to_be_signed[32..64]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 62 in zcash_proofs/src/sapling/verifier.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

this expression borrows a value the compiler would automatically borrow

warning: this expression borrows a value the compiler would automatically borrow
  --> zcash_proofs/src/sapling/verifier.rs:62:9
   |
62 |         (&mut data_to_be_signed[32..64]).copy_from_slice(&sighash_value[..]);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `data_to_be_signed[32..64]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 247 in zcash_proofs/src/sapling/prover.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

this expression borrows a value the compiler would automatically borrow

warning: this expression borrows a value the compiler would automatically borrow
   --> zcash_proofs/src/sapling/prover.rs:247:9
    |
247 |         (&mut data_to_be_signed[32..64]).copy_from_slice(&sighash[..]);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `data_to_be_signed[32..64]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 90 in zcash_proofs/src/sapling/prover.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

using `clone` on type `SubgroupPoint` which implements the `Copy` trait

warning: using `clone` on type `SubgroupPoint` which implements the `Copy` trait
  --> zcash_proofs/src/sapling/prover.rs:90:23
   |
90 |             PublicKey(proof_generation_key.ak.clone().into()).randomize(ar, SPENDING_KEY_GENERATOR);
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `proof_generation_key.ak`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
   = note: `-W clippy::clone-on-copy` implied by `-W clippy::all`
   = help: to override `-W clippy::all` add `#[allow(clippy::clone_on_copy)]`

Check warning on line 460 in zcash_proofs/src/circuit/sprout/mod.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

used `unwrap()` on `Some` value

warning: used `unwrap()` on `Some` value
   --> zcash_proofs/src/circuit/sprout/mod.rs:460:40
    |
460 |             .write_u64::<LittleEndian>(vpub_new.unwrap())
    |                                        ^^^^^^^^^^^^^^^^^
    |
help: remove the `Some` and `unwrap()`
   --> zcash_proofs/src/circuit/sprout/mod.rs:413:24
    |
413 |         let vpub_new = Some(test_vector.read_u64::<LittleEndian>().unwrap());
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_unwrap

Check warning on line 457 in zcash_proofs/src/circuit/sprout/mod.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

used `unwrap()` on `Some` value

warning: used `unwrap()` on `Some` value
   --> zcash_proofs/src/circuit/sprout/mod.rs:457:40
    |
457 |             .write_u64::<LittleEndian>(vpub_old.unwrap())
    |                                        ^^^^^^^^^^^^^^^^^
    |
help: remove the `Some` and `unwrap()`
   --> zcash_proofs/src/circuit/sprout/mod.rs:412:24
    |
412 |         let vpub_old = Some(test_vector.read_u64::<LittleEndian>().unwrap());
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_unwrap

Check warning on line 449 in zcash_proofs/src/circuit/sprout/mod.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

used `unwrap()` on `Some` value

warning: used `unwrap()` on `Some` value
   --> zcash_proofs/src/circuit/sprout/mod.rs:449:32
    |
449 |         expected_inputs.extend(h_sig.unwrap().to_vec());
    |                                ^^^^^^^^^^^^^^
    |
help: remove the `Some` and `unwrap()`
   --> zcash_proofs/src/circuit/sprout/mod.rs:362:21
    |
362 |         let h_sig = Some(get_u256(&mut test_vector));
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_unwrap

Check warning on line 448 in zcash_proofs/src/circuit/sprout/mod.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

used `unwrap()` on `Some` value

warning: used `unwrap()` on `Some` value
   --> zcash_proofs/src/circuit/sprout/mod.rs:448:32
    |
448 |         expected_inputs.extend(rt.unwrap().to_vec());
    |                                ^^^^^^^^^^^
    |
help: remove the `Some` and `unwrap()`
   --> zcash_proofs/src/circuit/sprout/mod.rs:361:18
    |
361 |         let rt = Some(get_u256(&mut test_vector));
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_unwrap
    = note: `-W clippy::unnecessary-literal-unwrap` implied by `-W clippy::all`
    = help: to override `-W clippy::all` add `#[allow(clippy::unnecessary_literal_unwrap)]`

Check warning on line 69 in zcash_proofs/src/circuit/sprout/input.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

dereferencing a tuple pattern where every element takes a reference

warning: dereferencing a tuple pattern where every element takes a reference
  --> zcash_proofs/src/circuit/sprout/input.rs:69:37
   |
69 |                 layer.as_ref().map(|&(ref sibling, _)| &sibling[..]),
   |                                     ^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
   = note: `-W clippy::needless-borrowed-reference` implied by `-W clippy::all`
   = help: to override `-W clippy::all` add `#[allow(clippy::needless_borrowed_reference)]`
help: try removing the `&` and `ref` parts
   |
69 -                 layer.as_ref().map(|&(ref sibling, _)| &sibling[..]),
69 +                 layer.as_ref().map(|(sibling, _)| &sibling[..]),
   |

Check warning on line 740 in zcash_proofs/src/circuit/sapling.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> zcash_proofs/src/circuit/sapling.rs:740:45
    |
740 |                 bls12_381::Scalar::from_str(&expected_commitment_vs[i as usize]).unwrap()
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `expected_commitment_vs[i as usize]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 736 in zcash_proofs/src/circuit/sapling.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> zcash_proofs/src/circuit/sapling.rs:736:45
    |
736 |                 bls12_381::Scalar::from_str(&expected_commitment_us[i as usize]).unwrap()
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `expected_commitment_us[i as usize]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `-W clippy::needless-borrow` implied by `-W clippy::all`
    = help: to override `-W clippy::all` add `#[allow(clippy::needless_borrow)]`

Check warning on line 694 in zcash_proofs/src/circuit/sapling.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

useless use of `vec!`

warning: useless use of `vec!`
   --> zcash_proofs/src/circuit/sapling.rs:683:34
    |
683 |       let expected_commitment_vs = vec![
    |  __________________________________^
684 | |         "27630722367128086497290371604583225252915685718989450292520883698391703910",
685 | |         "23310648738313092772044712773481584369462075017189681529702825235349449805260",
686 | |         "25709635353183537915646348052945798827495141780341329896098121888376871589480",
...   |
693 | |         "32959334601512756708397683646222389414681003290313255304927423560477040775488",
694 | |     ];
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
help: you can use an array directly
    |
683 ~     let expected_commitment_vs = ["27630722367128086497290371604583225252915685718989450292520883698391703910",
684 +         "23310648738313092772044712773481584369462075017189681529702825235349449805260",
685 +         "25709635353183537915646348052945798827495141780341329896098121888376871589480",
686 +         "10516315852014492141081718791576479298042117442649432716255936672048164184691",
687 +         "23970713991179488695004801139667700217127937225554773561645815034212389459772",
688 +         "3256052161046564597126736968199320852691566092694819239485673781545479548450",
689 +         "18887250722195819674378865377623103071236046274361890247643850134985809137409",
690 +         "36501156873031641173054592888886902104303750771545647842488588827138867116570",
691 +         "21927526310070011864833939629345235038589128172309792087590183778192091594775",
692 ~         "32959334601512756708397683646222389414681003290313255304927423560477040775488"];
    |

Check warning on line 681 in zcash_proofs/src/circuit/sapling.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

useless use of `vec!`

warning: useless use of `vec!`
   --> zcash_proofs/src/circuit/sapling.rs:670:34
    |
670 |       let expected_commitment_us = vec![
    |  __________________________________^
671 | |         "43821661663052659750276289184181083197337192946256245809816728673021647664276",
672 | |         "7220807656052227578299730541645543434083158611414003423211850718229633594616",
673 | |         "13239753550660714843257636471668037031928211668773449453628093339627668081697",
...   |
680 | |         "18269767207277008186871145355531741929166733260352590789136389380124992250945",
681 | |     ];
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
    = note: `-W clippy::useless-vec` implied by `-W clippy::all`
    = help: to override `-W clippy::all` add `#[allow(clippy::useless_vec)]`
help: you can use an array directly
    |
670 ~     let expected_commitment_us = ["43821661663052659750276289184181083197337192946256245809816728673021647664276",
671 +         "7220807656052227578299730541645543434083158611414003423211850718229633594616",
672 +         "13239753550660714843257636471668037031928211668773449453628093339627668081697",
673 +         "10900524635678389360790699587556574797582192824300145558807405770494079767974",
674 +         "1411013767457690636461779630023011774660680126764323588543800715293173598850",
675 +         "32334206652383066267661379202183359608706535021387905923603014648832344657662",
676 +         "20206750741605167608500278423400565295188703622528437817438897624149653579380",
677 +         "46716485782200334735478719487356079850582051575003452698983255860512578229998",
678 +         "31221372899739042781372142393132358519434268512685538373976981051223051220367",
679 ~         "18269767207277008186871145355531741929166733260352590789136389380124992250945"];
    |

Check warning on line 495 in components/equihash/src/verify.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> components/equihash/src/verify.rs:495:77
    |
495 |                 is_valid_solution_recursive(tv.params, tv.input, &tv.nonce, &tv.solution)
    |                                                                             ^^^^^^^^^^^^ help: change this to: `tv.solution`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 489 in components/equihash/src/verify.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> components/equihash/src/verify.rs:489:77
    |
489 |                 is_valid_solution_iterative(tv.params, tv.input, &tv.nonce, &tv.solution)
    |                                                                             ^^^^^^^^^^^^ help: change this to: `tv.solution`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 317 in components/equihash/src/verify.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> components/equihash/src/verify.rs:317:26
    |
317 |         Ok(Node::new(&p, &state, indices[0]))
    |                          ^^^^^^ help: change this to: `state`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 317 in components/equihash/src/verify.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> components/equihash/src/verify.rs:317:22
    |
317 |         Ok(Node::new(&p, &state, indices[0]))
    |                      ^^ help: change this to: `p`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `-W clippy::needless-borrow` implied by `-W clippy::all`
    = help: to override `-W clippy::all` add `#[allow(clippy::needless_borrow)]`

Check warning on line 224 in components/equihash/src/verify.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

usage of `mem::size_of::<T>()` to obtain the size of `T` in bits

warning: usage of `mem::size_of::<T>()` to obtain the size of `T` in bits
   --> components/equihash/src/verify.rs:224:23
    |
224 |     let len_indices = 8 * size_of::<u32>() * minimal.len() / (c_bit_len + 1);
    |                       ^^^^^^^^^^^^^^^^^^^^ help: consider using: `u32::BITS as usize`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_bits

Check warning on line 173 in components/equihash/src/verify.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

usage of `mem::size_of::<T>()` to obtain the size of `T` in bits

warning: usage of `mem::size_of::<T>()` to obtain the size of `T` in bits
   --> components/equihash/src/verify.rs:173:13
    |
173 |     assert!(8 * size_of::<u32>() >= 7 + bit_len);
    |             ^^^^^^^^^^^^^^^^^^^^ help: consider using: `u32::BITS as usize`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_bits
    = note: `-W clippy::manual-bits` implied by `-W clippy::all`
    = help: to override `-W clippy::all` add `#[allow(clippy::manual_bits)]`

Check warning on line 40 in zcash_proofs/src/circuit/ecc.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

accessing first element with `chunk.get(0)`

warning: accessing first element with `chunk.get(0)`
  --> zcash_proofs/src/circuit/ecc.rs:39:23
   |
39 |           let chunk_a = chunk
   |  _______________________^
40 | |             .get(0)
   | |___________________^ help: try: `chunk.first()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
   = note: `-W clippy::get-first` implied by `-W clippy::all`
   = help: to override `-W clippy::all` add `#[allow(clippy::get_first)]`

Check warning on line 102 in zcash_extensions/src/transparent/demo.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
   --> zcash_extensions/src/transparent/demo.rs:102:12
    |
102 |     fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
    |            ^^                                ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
102 -     fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
102 +     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
    |

Check warning on line 98 in zcash_extensions/src/consensus/transparent.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
   --> zcash_extensions/src/consensus/transparent.rs:98:15
    |
98  |     fn verify<'a>(
    |               ^^
...
102 |         ctx: &Context<'a>,
    |                       ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
98  ~     fn verify(
99  |         &self,
100 |         precondition: &Precondition,
101 |         witness: &Witness,
102 ~         ctx: &Context<'_>,
    |

Check warning on line 67 in zcash_extensions/src/consensus/transparent.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
  --> zcash_extensions/src/consensus/transparent.rs:67:15
   |
67 |     fn verify<'a>(
   |               ^^
...
71 |         ctx: &Context<'a>,
   |                       ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `-W clippy::needless-lifetimes` implied by `-W clippy::all`
   = help: to override `-W clippy::all` add `#[allow(clippy::needless_lifetimes)]`
help: elide the lifetimes
   |
67 ~     fn verify(
68 |         &self,
69 |         precondition: &Precondition,
70 |         witness: &Witness,
71 ~         ctx: &Context<'_>,
   |

Check warning on line 461 in components/zcash_note_encryption/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy (nightly)

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> components/zcash_note_encryption/src/lib.rs:461:31
    |
461 |             .open_to(&mut op, &out_ciphertext, &[], ock.as_ref(), &[0u8; 12])
    |                               ^^^^^^^^^^^^^^^ help: change this to: `out_ciphertext`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow