Skip to content

introduce PackedProofs to semaphore-rs for Oxide branch (#85) (#87)

Sign in for the full log view
GitHub Actions / clippy succeeded Sep 16, 2024 in 0s

clippy

25 warnings

Details

Results

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

Versions

  • rustc 1.72.0-nightly (f0411ffce 2023-05-30)
  • cargo 1.72.0-nightly (64fb38c97 2023-05-23)
  • clippy 0.1.71 (f0411ff 2023-05-30)

Annotations

Check warning on line 1152 in src/lazy_merkle_tree.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

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
    --> src/lazy_merkle_tree.rs:1152:27
     |
1152 |         if file.write_all(&buf).is_err() {
     |                           ^^^^ help: change this to: `buf`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 984 in src/lazy_merkle_tree.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

temporary with significant `Drop` can be early dropped

warning: temporary with significant `Drop` can be early dropped
   --> src/lazy_merkle_tree.rs:984:17
    |
983 |       fn update_with_mutation(&self, index: usize, value: &H::Hash) {
    |  ___________________________________________________________________-
984 | |         let mut storage = self.storage.lock().expect("lock poisoned, terminating");
    | |                 ^^^^^^^
985 | |         let leaf_index_in_dense_tree = index + (self.root_index << self.depth);
986 | |         storage[leaf_index_in_dense_tree] = value.clone();
...   |
993 | |         }
994 | |     }
    | |_____- temporary `storage` is currently being dropped at the end of its contained scope
    |
    = note: this might lead to unnecessary resource contention
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
help: merge the temporary construction with its single usage
    |
984 ~         
985 +         self.storage.lock().expect("lock poisoned, terminating").;
    |
help: remove separated single usage
    |
986 -         storage[leaf_index_in_dense_tree] = value.clone();
986 +         
    |

Check warning on line 747 in src/lazy_merkle_tree.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

temporary with significant `Drop` can be early dropped

warning: temporary with significant `Drop` can be early dropped
   --> src/lazy_merkle_tree.rs:747:17
    |
746 |       fn update_with_mutation(&self, index: usize, value: &H::Hash) {
    |  ___________________________________________________________________-
747 | |         let mut storage = self.storage.lock().expect("lock poisoned, terminating");
    | |                 ^^^^^^^
748 | |         let leaf_index_in_dense_tree = index + (self.root_index << self.depth);
749 | |         storage[leaf_index_in_dense_tree] = value.clone();
...   |
756 | |         }
757 | |     }
    | |_____- temporary `storage` is currently being dropped at the end of its contained scope
    |
    = note: this might lead to unnecessary resource contention
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
    = note: `#[warn(clippy::significant_drop_tightening)]` implied by `#[warn(clippy::nursery)]`
help: merge the temporary construction with its single usage
    |
747 ~         
748 +         self.storage.lock().expect("lock poisoned, terminating").;
    |
help: remove separated single usage
    |
749 -         storage[leaf_index_in_dense_tree] = value.clone();
749 +         
    |

Check warning on line 563 in src/lazy_merkle_tree.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant clone

warning: redundant clone
   --> src/lazy_merkle_tree.rs:563:39
    |
563 |             let right = children.right.clone();
    |                                       ^^^^^^^^ help: remove this
    |
note: cloned value is neither consumed nor mutated
   --> src/lazy_merkle_tree.rs:563:25
    |
563 |             let right = children.right.clone();
    |                         ^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

Check warning on line 562 in src/lazy_merkle_tree.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant clone

warning: redundant clone
   --> src/lazy_merkle_tree.rs:562:37
    |
562 |             let left = children.left.clone();
    |                                     ^^^^^^^^ help: remove this
    |
note: cloned value is neither consumed nor mutated
   --> src/lazy_merkle_tree.rs:562:24
    |
562 |             let left = children.left.clone();
    |                        ^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone
    = note: `#[warn(clippy::redundant_clone)]` implied by `#[warn(clippy::all)]`

Check warning on line 92 in src/lazy_merkle_tree.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/lazy_merkle_tree.rs:86:5
   |
86 | /     pub fn new_mmapped_with_dense_prefix_with_init_values(
87 | |         depth: usize,
88 | |         prefix_depth: usize,
89 | |         empty_value: &H::Hash,
90 | |         initial_values: &[H::Hash],
91 | |         file_path: &str,
92 | |     ) -> Result<LazyMerkleTree<H, Canonical>, DenseMMapError> {
   | |_____________________________________________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 92 in src/lazy_merkle_tree.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has an empty `#[must_use]` attribute, but returns a type already marked as `#[must_use]`

warning: this function has an empty `#[must_use]` attribute, but returns a type already marked as `#[must_use]`
  --> src/lazy_merkle_tree.rs:86:5
   |
86 | /     pub fn new_mmapped_with_dense_prefix_with_init_values(
87 | |         depth: usize,
88 | |         prefix_depth: usize,
89 | |         empty_value: &H::Hash,
90 | |         initial_values: &[H::Hash],
91 | |         file_path: &str,
92 | |     ) -> Result<LazyMerkleTree<H, Canonical>, DenseMMapError> {
   | |_____________________________________________________________^
   |
   = help: either add some descriptive text or remove the attribute
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_must_use
   = note: `#[warn(clippy::double_must_use)]` implied by `#[warn(clippy::all)]`

Check warning on line 177 in src/protocol/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function which may panic missing `# Panics` section

warning: docs for function which may panic missing `# Panics` section
   --> src/protocol/mod.rs:172:1
    |
172 | / pub fn generate_witness(
173 | |     identity: &Identity,
174 | |     merkle_proof: &merkle_tree::Proof<PoseidonHash>,
175 | |     external_nullifier_hash: Field,
176 | |     signal_hash: Field,
177 | | ) -> Vec<Fr> {
    | |____________^
    |
note: first possible panic found here
   --> src/protocol/mod.rs:191:51
    |
191 |         [get_depth_index(depth).unwrap_or_else(|| panic!("Depth {depth} not supported"))];
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
    = note: `#[warn(clippy::missing_panics_doc)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 177 in src/protocol/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function could have a `#[must_use]` attribute

warning: this function could have a `#[must_use]` attribute
   --> src/protocol/mod.rs:172:1
    |
172 | / pub fn generate_witness(
173 | |     identity: &Identity,
174 | |     merkle_proof: &merkle_tree::Proof<PoseidonHash>,
175 | |     external_nullifier_hash: Field,
176 | |     signal_hash: Field,
177 | | ) -> Vec<Fr> {
    | |____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
    = note: `#[warn(clippy::must_use_candidate)]` implied by `#[warn(clippy::pedantic)]`
help: add the attribute
    |
172 + #[must_use] pub fn generate_witness(
173 +     identity: &Identity,
174 +     merkle_proof: &merkle_tree::Proof<PoseidonHash>,
175 +     external_nullifier_hash: Field,
176 +     signal_hash: Field,
177 ~ ) -> Vec<Fr> {
    |

Check warning on line 38 in src/protocol/authentication.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> src/protocol/authentication.rs:31:5
   |
31 | /     return super::verify_proof(
32 | |         root,
33 | |         nullifier_hash,
34 | |         signal_hash,
...  |
37 | |         depth,
38 | |     );
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = help: remove `return`

Check warning on line 27 in src/protocol/authentication.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/protocol/authentication.rs:20:1
   |
20 | / pub fn verify_proof(
21 | |     depth: usize,
22 | |     id_commitment: Field,
23 | |     nullifier_hash: Field,
...  |
26 | |     proof: &Proof,
27 | | ) -> Result<bool, ProofError> {
   | |_____________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 17 in src/protocol/authentication.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> src/protocol/authentication.rs:17:5
   |
17 |     return super::generate_proof(identity, &merkle_proof, ext_nullifier_hash, signal_hash);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` implied by `#[warn(clippy::all)]`
   = help: remove `return`

Check warning on line 13 in src/protocol/authentication.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/protocol/authentication.rs:8:1
   |
8  | / pub fn generate_proof(
9  | |     depth: usize,
10 | |     identity: &Identity,
11 | |     ext_nullifier_hash: Field,
12 | |     signal_hash: Field,
13 | | ) -> Result<Proof, ProofError> {
   | |______________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
note: the lint level is defined here
  --> src/lib.rs:2:22
   |
2  | #![warn(clippy::all, clippy::pedantic, clippy::cargo, clippy::nursery)]
   |                      ^^^^^^^^^^^^^^^^
   = note: `#[warn(clippy::missing_errors_doc)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 54 in src/packed_proof.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider implementing `TryFrom` instead

warning: consider implementing `TryFrom` instead
  --> src/packed_proof.rs:38:1
   |
38 | / impl From<PackedProof> for Proof {
39 | |     fn from(proof: PackedProof) -> Self {
40 | |         let decoded = decode(&vec![ParamType::Uint(256); 8], &proof.0).unwrap();
41 | |         let decoded_uint_array = decoded
...  |
53 | |     }
54 | | }
   | |_^
   |
   = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
note: potential failure(s)
  --> src/packed_proof.rs:40:23
   |
40 |         let decoded = decode(&vec![ParamType::Uint(256); 8], &proof.0).unwrap();
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#fallible_impl_from
note: the lint level is defined here
  --> src/lib.rs:2:55
   |
2  | #![warn(clippy::all, clippy::pedantic, clippy::cargo, clippy::nursery)]
   |                                                       ^^^^^^^^^^^^^^^
   = note: `#[warn(clippy::fallible_impl_from)]` implied by `#[warn(clippy::nursery)]`

Check warning on line 30 in src/circuit.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

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
  --> src/circuit.rs:30:5
   |
30 |     &GRAPH_BYTES[index]
   |     ^^^^^^^^^^^^^^^^^^^ help: change this to: `GRAPH_BYTES[index]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
note: the lint level is defined here
  --> src/lib.rs:2:9
   |
2  | #![warn(clippy::all, clippy::pedantic, clippy::cargo, clippy::nursery)]
   |         ^^^^^^^^^^^
   = note: `#[warn(clippy::needless_borrow)]` implied by `#[warn(clippy::all)]`

Check warning on line 1 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

package `ark-zkey` is missing `package.categories` metadata

warning: package `ark-zkey` is missing `package.categories` metadata
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata

Check warning on line 1 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

package `ark-zkey` is missing `package.keywords` metadata

warning: package `ark-zkey` is missing `package.keywords` metadata
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata

Check warning on line 1 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

package `ark-zkey` is missing `package.repository` metadata

warning: package `ark-zkey` is missing `package.repository` metadata
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata

Check warning on line 1 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

package `ark-zkey` is missing `either package.license or package.license_file` metadata

warning: package `ark-zkey` is missing `either package.license or package.license_file` metadata
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata

Check warning on line 1 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

package `ark-zkey` is missing `package.description` metadata

warning: package `ark-zkey` is missing `package.description` metadata
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata
note: the lint level is defined here
 --> src/lib.rs:2:40
  |
2 | #![warn(clippy::all, clippy::pedantic, clippy::cargo, clippy::nursery)]
  |                                        ^^^^^^^^^^^^^
  = note: `#[warn(clippy::cargo_common_metadata)]` implied by `#[warn(clippy::cargo)]`

Check warning on line 9 in build.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this import is redundant

warning: this import is redundant
 --> build.rs:9:1
  |
9 | use ark_zkey;
  | ^^^^^^^^^^^^^ help: remove it entirely
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports
  = note: `#[warn(clippy::single_component_path_imports)]` on by default

Check warning on line 207 in crates/ark-zkey/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits
   --> crates/ark-zkey/src/lib.rs:207:22
    |
207 |         File::create(&serialized_path).wrap_err("Failed to create serialized proving key file")?;
    |                      ^^^^^^^^^^^^^^^^ help: change this to: `serialized_path`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `#[warn(clippy::needless_borrow)]` on by default

Check warning on line 204 in crates/ark-zkey/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `std::path::PathBuf`

warning: useless conversion to the same type: `std::path::PathBuf`
   --> crates/ark-zkey/src/lib.rs:204:27
    |
204 |     let serialized_path = PathBuf::from(arkzkey_file_path);
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `PathBuf::from()`: `arkzkey_file_path`
    |
    = 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 207 in crates/ark-zkey/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits
   --> crates/ark-zkey/src/lib.rs:207:22
    |
207 |         File::create(&serialized_path).wrap_err("Failed to create serialized proving key file")?;
    |                      ^^^^^^^^^^^^^^^^ help: change this to: `serialized_path`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `#[warn(clippy::needless_borrow)]` on by default

Check warning on line 204 in crates/ark-zkey/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `std::path::PathBuf`

warning: useless conversion to the same type: `std::path::PathBuf`
   --> crates/ark-zkey/src/lib.rs:204:27
    |
204 |     let serialized_path = PathBuf::from(arkzkey_file_path);
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `PathBuf::from()`: `arkzkey_file_path`
    |
    = 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