Skip to content

Merge pull request #633 from worldcoin/Dzejkop/stronger-docker-utils #411

Merge pull request #633 from worldcoin/Dzejkop/stronger-docker-utils

Merge pull request #633 from worldcoin/Dzejkop/stronger-docker-utils #411

This check has been archived and is scheduled for deletion. Learn more about checks retention
GitHub Actions / clippy succeeded Oct 13, 2023 in 3s

clippy

108 warnings

Details

Results

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

Versions

  • rustc 1.74.0-nightly (4e78abb43 2023-08-28)
  • cargo 1.74.0-nightly (925280f02 2023-08-25)
  • clippy 0.1.73 (4e78abb 2023-08-28)

Annotations

Check warning on line 730 in src/prover/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused `async` for function with no await statements

warning: unused `async` for function with no await statements
   --> src/prover/mod.rs:698:9
    |
698 | /         pub async fn new(url: String) -> anyhow::Result<Self> {
699 | |             let prove = |Json(payload): Json<InsertionProofInput>| async move {
700 | |                 match payload.post_root.div_mod(U256::from(2)) {
701 | |                     (_, y) if y != U256::zero() => {
...   |
729 | |             Ok(service)
730 | |         }
    | |_________^
    |
    = help: consider removing the `async` from this function
note: `await` used in an async block, which does not require the enclosing function to be `async`
   --> src/prover/mod.rs:724:22
    |
724 |                     .await
    |                      ^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_async
    = note: `#[warn(clippy::unused_async)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 28 in src/utils.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/utils.rs:28:5
   |
28 |     fn any_flatten(self) -> AnyhowResult<A>;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 15 in src/utils.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/utils.rs:15:5
   |
15 |     fn any(self) -> AnyhowResult<A>;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
   = note: `#[warn(clippy::missing_errors_doc)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 3 in src/utils/tree_updates.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/utils/tree_updates.rs:3:1
  |
3 | pub fn dedup_tree_updates(updates: Vec<TreeUpdate>) -> Vec<TreeUpdate> {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn dedup_tree_updates(updates: Vec<TreeUpdate>) -> Vec<TreeUpdate>`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate

Check warning on line 11 in src/utils/index_packing.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/utils/index_packing.rs:11:1
   |
11 | pub fn unpack_indices(packed: &[u8]) -> Vec<u32> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first possible panic found here
  --> src/utils/index_packing.rs:15:40
   |
15 |         let index = u32::from_be_bytes(packed_index.try_into().expect("Invalid index length"));
   |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check warning on line 11 in src/utils/index_packing.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/utils/index_packing.rs:11:1
   |
11 | pub fn unpack_indices(packed: &[u8]) -> Vec<u32> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn unpack_indices(packed: &[u8]) -> Vec<u32>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate

Check warning on line 1 in src/utils/index_packing.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/utils/index_packing.rs:1:1
  |
1 | pub fn pack_indices(indices: &[u32]) -> Vec<u8> {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn pack_indices(indices: &[u32]) -> Vec<u8>`
  |
  = 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)]`

Check warning on line 920 in /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prometheus-0.13.3/src/macros.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

matching over `()` is more explicit

warning: matching over `()` is more explicit
  --> src/task_monitor.rs:45:5
   |
45 | /     register_histogram!(
46 | |         "submitted_batch_sizes",
47 | |         "Submitted batch size",
48 | |         linear_buckets(f64::from(1), f64::from(1), 100).unwrap()
49 | |     )
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
   = note: this warning originates in the macro `register_histogram` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 546 in /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prometheus-0.13.3/src/macros.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

matching over `()` is more explicit

warning: matching over `()` is more explicit
  --> src/task_monitor.rs:37:5
   |
37 | /     register_gauge!(
38 | |         "unprocessed_identities",
39 | |         "Identities not processed by identity committer"
40 | |     )
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
   = note: this warning originates in the macro `__register_gauge` which comes from the expansion of the macro `register_gauge` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 546 in /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prometheus-0.13.3/src/macros.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

matching over `()` is more explicit

warning: matching over `()` is more explicit
  --> src/task_monitor.rs:33:5
   |
33 |     register_gauge!("pending_identities", "Identities not submitted on-chain").unwrap()
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
   = note: this warning originates in the macro `__register_gauge` which comes from the expansion of the macro `register_gauge` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 490 in src/task_monitor/tasks/process_identities.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers

warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers
   --> src/task_monitor/tasks/process_identities.rs:490:31
    |
490 |     let pad_index = 2_u32.pow(latest_tree_from_updates.depth() as u32);
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation
help: ... or use `try_from` and handle the error accordingly
    |
490 |     let pad_index = 2_u32.pow(u32::try_from(latest_tree_from_updates.depth()));
    |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 449 in src/task_monitor/tasks/process_identities.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers

warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers
   --> src/task_monitor/tasks/process_identities.rs:449:18
    |
449 |         .map(|f| f.update.leaf_index as u32)
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation
help: ... or use `try_from` and handle the error accordingly
    |
449 |         .map(|f| u32::try_from(f.update.leaf_index))
    |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 280 in src/task_monitor/tasks/process_identities.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variables can be used directly in the `format!` string

warning: variables can be used directly in the `format!` string
   --> src/task_monitor/tasks/process_identities.rs:276:13
    |
276 | /             panic!(
277 | |                 "Identities are not consecutive leaves in the tree (leaf_indexes = {:?}, \
278 | |                  commitments = {:?})",
279 | |                 leaf_indexes, commitments
280 | |             );
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args

Check warning on line 237 in src/task_monitor/tasks/process_identities.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary `!=` operation

warning: unnecessary `!=` operation
   --> src/task_monitor/tasks/process_identities.rs:207:5
    |
207 | /     if updates
208 | |         .first()
209 | |         .context("Updates should be > 1")?
210 | |         .update
...   |
236 | |         delete_identities(database, identity_manager, batching_tree, updates, prover).await?;
237 | |     }
    | |_____^
    |
    = help: change to `==` and swap the blocks of the `if`/`else`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
    = note: `#[warn(clippy::if_not_else)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 324 in src/task_monitor/tasks/finalize_identities.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u64` to `i64` may wrap around the value

warning: casting `u64` to `i64` may wrap around the value
   --> src/task_monitor/tasks/finalize_identities.rs:324:35
    |
324 |         chrono::Duration::seconds(root_history_expiry.as_u64() as i64);
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(clippy::cast_possible_wrap)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 306 in src/task_monitor/tasks/finalize_identities.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant closure

warning: redundant closure
   --> src/task_monitor/tasks/finalize_identities.rs:306:62
    |
306 |     let commitments: Vec<U256> = commitments.into_iter().map(|c| c.into()).collect();
    |                                                              ^^^^^^^^^^^^ help: replace the closure with the method itself: `std::convert::Into::into`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
    = note: `#[warn(clippy::redundant_closure_for_method_calls)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 195 in src/task_monitor/tasks/finalize_identities.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/task_monitor/tasks/finalize_identities.rs:195:17
    |
195 |                 &log,
    |                 ^^^^ help: change this to: `log`
    |
    = 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)]
    |         ^^^^^^^^^^^
    = note: `#[warn(clippy::needless_borrow)]` implied by `#[warn(clippy::all)]`

Check warning on line 920 in /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prometheus-0.13.3/src/macros.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

matching over `()` is more explicit

warning: matching over `()` is more explicit
  --> src/server/custom_middleware/api_metrics_layer.rs:23:5
   |
23 |     register_histogram!("api_latency_seconds", "The API latency in seconds.").unwrap()
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
   = note: this warning originates in the macro `register_histogram` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 364 in /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prometheus-0.13.3/src/macros.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

matching over `()` is more explicit

warning: matching over `()` is more explicit
  --> src/server/custom_middleware/api_metrics_layer.rs:14:5
   |
14 | /     register_int_counter_vec!(
15 | |         "api_response_status",
16 | |         "The API responses by status code.",
17 | |         &["status_code"]
18 | |     )
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
   = note: this warning originates in the macro `__register_counter_vec` which comes from the expansion of the macro `register_int_counter_vec` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 217 in /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prometheus-0.13.3/src/macros.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

matching over `()` is more explicit

warning: matching over `()` is more explicit
  --> src/server/custom_middleware/api_metrics_layer.rs:11:18
   |
11 |     Lazy::new(|| register_counter!(opts!("api_requests", "Number of requests received.")).unwrap());
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
   = note: this warning originates in the macro `register_counter` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 73 in src/server/error.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/server/error.rs:73:5
   |
73 |     pub fn to_response(&self) -> hyper::Response<Body> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first possible panic found here
  --> src/server/error.rs:88:9
   |
88 | /         hyper::Response::builder()
89 | |             .status(status_code)
90 | |             .body(hyper::Body::from(self.to_string()))
91 | |             .expect("Failed to convert error string into hyper::Body")
   | |______________________________________________________________________^
   = 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 359 in src/prover/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this argument is passed by value, but not consumed in the function body

warning: this argument is passed by value, but not consumed in the function body
   --> src/prover/mod.rs:359:23
    |
359 |     deletion_indices: Vec<u32>,
    |                       ^^^^^^^^ help: consider changing the type to: `&[u32]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
    = note: `#[warn(clippy::needless_pass_by_value)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 920 in /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prometheus-0.13.3/src/macros.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

matching over `()` is more explicit

warning: matching over `()` is more explicit
  --> src/prover/mod.rs:47:5
   |
47 | /     register_histogram!(
48 | |         "prover_proving_time",
49 | |         "Only the time between sending a request and receiving the proof",
50 | |         exponential_buckets(0.1, 1.5, 25).unwrap()
51 | |     )
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
   = note: this warning originates in the macro `register_histogram` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 920 in /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prometheus-0.13.3/src/macros.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

matching over `()` is more explicit

warning: matching over `()` is more explicit
  --> src/prover/mod.rs:38:5
   |
38 | /     register_histogram!(
39 | |         "total_proving_time",
40 | |         "The time to generate a proof in seconds. Includes preparing the data for the prover",
41 | |         exponential_buckets(0.1, 1.5, 25).unwrap()
42 | |     )
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
   = note: this warning originates in the macro `register_histogram` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 364 in /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prometheus-0.13.3/src/macros.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

matching over `()` is more explicit

warning: matching over `()` is more explicit
  --> src/ethereum/write_oz/openzeppelin.rs:19:5
   |
19 | /     register_int_counter_vec!("eth_tx_count", "The transaction count by bytes4.", &[
20 | |         "bytes4"
21 | |     ])
   | |______^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
   = note: this warning originates in the macro `__register_counter_vec` which comes from the expansion of the macro `register_int_counter_vec` (in Nightly builds, run with -Z macro-backtrace for more info)