Skip to content

fix: just in time update #162

fix: just in time update

fix: just in time update #162

GitHub Actions / clippy succeeded Sep 27, 2023 in 0s

clippy

39 warnings

Details

Results

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

Versions

  • rustc 1.72.1 (d5c2e9c34 2023-09-13)
  • cargo 1.72.1 (103a7ff2e 2023-08-15)
  • clippy 0.1.72 (d5c2e9c 2023-09-13)

Annotations

Check warning on line 488 in grovedb/src/operations/proof/generate.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (9/7)

warning: this function has too many arguments (9/7)
   --> grovedb/src/operations/proof/generate.rs:478:5
    |
478 | /     fn generate_and_store_merk_proof<'a, S, B>(
479 | |         &self,
480 | |         path: &SubtreePath<B>,
481 | |         subtree: &'a Merk<S>,
...   |
487 | |         key: &[u8],
488 | |     ) -> CostResult<(Option<u16>, Option<u16>), Error>
    | |______________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 181 in grovedb/src/operations/proof/generate.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)
   --> grovedb/src/operations/proof/generate.rs:172:5
    |
172 | /     fn prove_subqueries(
173 | |         &self,
174 | |         proofs: &mut Vec<u8>,
175 | |         path: Vec<&[u8]>,
...   |
180 | |         is_verbose: bool,
181 | |     ) -> CostResult<(), Error> {
    | |______________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 525 in grovedb/src/operations/delete/mod.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
   --> grovedb/src/operations/delete/mod.rs:525:25
    |
525 |                         &batch,
    |                         ^^^^^^ help: change this to: `batch`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 272 in grovedb/src/operations/delete/mod.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
   --> grovedb/src/operations/delete/mod.rs:272:13
    |
272 |             &batch,
    |             ^^^^^^ help: change this to: `batch`
    |
    = 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 71 in grovedb/src/operations/delete/worst_case.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting to the same type is unnecessary (`u16` -> `u16`)

warning: casting to the same type is unnecessary (`u16` -> `u16`)
  --> grovedb/src/operations/delete/worst_case.rs:71:46
   |
71 |             for height in (stop_path_height..(path_len as u16)).rev() {
   |                                              ^^^^^^^^^^^^^^^^^ help: try: `path_len`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 76 in grovedb/src/operations/delete/average_case.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting to the same type is unnecessary (`u16` -> `u16`)

warning: casting to the same type is unnecessary (`u16` -> `u16`)
  --> grovedb/src/operations/delete/average_case.rs:76:46
   |
76 |             for height in (stop_path_height..(path_len as u16)).rev() {
   |                                              ^^^^^^^^^^^^^^^^^ help: try: `path_len`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
   = note: `#[warn(clippy::unnecessary_cast)]` on by default

Check warning on line 548 in grovedb/src/element/query.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)
   --> grovedb/src/element/query.rs:535:5
    |
535 | /     fn query_item(
536 | |         storage: &RocksDbStorage,
537 | |         item: &QueryItem,
538 | |         results: &mut Vec<QueryResultElement>,
...   |
547 | |         add_element_function: fn(PathQueryPushArgs) -> CostResult<(), Error>,
548 | |     ) -> CostResult<(), Error> {
    | |______________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 147 in grovedb/src/element/query.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)
   --> grovedb/src/element/query.rs:138:5
    |
138 | /     pub fn get_query_apply_function(
139 | |         storage: &RocksDbStorage,
140 | |         path: &[&[u8]],
141 | |         sized_query: &SizedQuery,
...   |
146 | |         add_element_function: fn(PathQueryPushArgs) -> CostResult<(), Error>,
147 | |     ) -> CostResult<(QueryResultElements, u16), Error> {
    | |______________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
    = note: `#[warn(clippy::too_many_arguments)]` on by default

Check warning on line 1586 in grovedb/src/batch/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

implicitly performing saturating subtraction

warning: implicitly performing saturating subtraction
    --> grovedb/src/batch/mod.rs:1584:13
     |
1584 | /             if current_level > 0 {
1585 | |                 current_level -= 1;
1586 | |             }
     | |_____________^ help: try: `current_level = current_level.saturating_sub(1);`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_saturating_sub
     = note: `#[warn(clippy::implicit_saturating_sub)]` on by default

Check warning on line 238 in grovedb/src/batch/estimated_costs/average_case_costs.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

iterating on a map's keys

warning: iterating on a map's keys
   --> grovedb/src/batch/estimated_costs/average_case_costs.rs:235:33
    |
235 |                       let paths = self
    |  _________________________________^
236 | |                         .paths
237 | |                         .iter()
238 | |                         .map(|(k, _v)| k.0.iter().map(|k| hex::encode(k.as_slice())).join("/"))
    | |_______________________________________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map
help: try
    |
235 ~                     let paths = self
236 +                         .paths.keys().map(|k| k.0.iter().map(|k| hex::encode(k.as_slice())).join("/"))
    |

Check warning on line 216 in grovedb/src/batch/estimated_costs/average_case_costs.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

iterating on a map's keys

warning: iterating on a map's keys
   --> grovedb/src/batch/estimated_costs/average_case_costs.rs:213:29
    |
213 |                   let paths = self
    |  _____________________________^
214 | |                     .paths
215 | |                     .iter()
216 | |                     .map(|(k, _v)| k.0.iter().map(|k| hex::encode(k.as_slice())).join("/"))
    | |___________________________________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map
    = note: `#[warn(clippy::iter_kv_map)]` on by default
help: try
    |
213 ~                 let paths = self
214 +                     .paths.keys().map(|k| k.0.iter().map(|k| hex::encode(k.as_slice())).join("/"))
    |

Check warning on line 12 in grovedb/src/versioning.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

function `read_proof_version` is never used

warning: function `read_proof_version` is never used
  --> grovedb/src/versioning.rs:12:8
   |
12 | pub fn read_proof_version(mut bytes: &[u8]) -> Result<u32, Error> {
   |        ^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

Check warning on line 263 in grovedb/src/operations/proof/verify.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `proof_version`

warning: unused variable: `proof_version`
   --> grovedb/src/operations/proof/verify.rs:263:14
    |
263 |         let (proof_version, proof) = read_and_consume_proof_version(proof)?;
    |              ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_proof_version`
    |
    = note: `#[warn(unused_variables)]` on by default

Check warning on line 5 in grovedb/src/versioning.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `Error::InternalError`

warning: unused import: `Error::InternalError`
 --> grovedb/src/versioning.rs:5:20
  |
5 | use crate::{Error, Error::InternalError};
  |                    ^^^^^^^^^^^^^^^^^^^^

Check warning on line 3 in grovedb/src/versioning.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `VarIntWriter`

warning: unused import: `VarIntWriter`
 --> grovedb/src/versioning.rs:3:46
  |
3 | use integer_encoding::{VarInt, VarIntReader, VarIntWriter};
  |                                              ^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

Check warning on line 1824 in grovedb/src/batch/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `else { if .. }` block can be collapsed

warning: this `else { if .. }` block can be collapsed
    --> grovedb/src/batch/mod.rs:1812:16
     |
1812 |           } else {
     |  ________________^
1813 | |             if new_merk {
1814 | |                 Ok(Merk::open_empty(storage, MerkType::BaseMerk, false)).wrap_with_cost(cost)
1815 | |             } else {
...    |
1823 | |             }
1824 | |         }
     | |_________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
     = note: `#[warn(clippy::collapsible_else_if)]` on by default
help: collapse nested if block
     |
1812 ~         } else if new_merk {
1813 +             Ok(Merk::open_empty(storage, MerkType::BaseMerk, false)).wrap_with_cost(cost)
1814 +         } else {
1815 +             Merk::open_base(
1816 +                 storage,
1817 +                 false,
1818 +                 Some(&Element::value_defined_cost_for_serialized_value),
1819 +             )
1820 +             .map_err(|_| Error::CorruptedData("cannot open a the root subtree".to_owned()))
1821 +             .add_cost(cost)
1822 +         }
     |

Check warning on line 79 in merk/src/estimated_costs/average_case_costs.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `impl` can be derived

warning: this `impl` can be derived
  --> merk/src/estimated_costs/average_case_costs.rs:75:1
   |
75 | / impl Default for EstimatedSumTrees {
76 | |     fn default() -> Self {
77 | |         EstimatedSumTrees::NoSumTrees
78 | |     }
79 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
   = note: `#[warn(clippy::derivable_impls)]` on by default
   = help: remove the manual implementation...
help: ...and instead derive it...
   |
60 + #[derive(Default)]
61 | pub enum EstimatedSumTrees {
   |
help: ...and mark the default variant
   |
62 ~     #[default]
63 ~     NoSumTrees,
   |

Check warning on line 833 in merk/src/tree/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)
   --> merk/src/tree/mod.rs:810:5
    |
810 | /     pub fn put_value_with_reference_value_hash_and_value_cost(
811 | |         mut self,
812 | |         value: Vec<u8>,
813 | |         value_hash: CryptoHash,
...   |
832 | |         >,
833 | |     ) -> CostResult<Self, Error> {
    | |________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 367 in merk/src/tree/walk/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)
   --> merk/src/tree/walk/mod.rs:344:5
    |
344 | /     pub fn put_value_with_reference_value_hash_and_value_cost(
345 | |         mut self,
346 | |         value: Vec<u8>,
347 | |         value_hash: CryptoHash,
...   |
366 | |         >,
367 | |     ) -> CostResult<Self, Error> {
    | |________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 638 in merk/src/tree/ops.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (9/7)

warning: this function has too many arguments (9/7)
   --> merk/src/tree/ops.rs:628:5
    |
628 | /     fn recurse<K: AsRef<[u8]>, C, V, U, R>(
629 | |         self,
630 | |         batch: &MerkBatch<K>,
631 | |         mid: usize,
...   |
637 | |         section_removal_bytes: &mut R,
638 | |     ) -> CostResult<(Option<Self>, KeyUpdates), Error>
    | |______________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 286 in merk/src/merk/apply.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)
   --> merk/src/merk/apply.rs:277:5
    |
277 | /     pub fn apply_unchecked<KB, KA, C, V, U, R>(
278 | |         &mut self,
279 | |         batch: &MerkBatch<KB>,
280 | |         aux: &AuxMerkBatch<KA>,
...   |
285 | |         section_removal_bytes: &mut R,
286 | |     ) -> CostResult<(), Error>
    | |______________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 199 in merk/src/merk/apply.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)
   --> merk/src/merk/apply.rs:176:5
    |
176 | /     pub fn apply_with_costs_just_in_time_value_update<KB, KA>(
177 | |         &mut self,
178 | |         batch: &MerkBatch<KB>,
179 | |         aux: &AuxMerkBatch<KA>,
...   |
198 | |         >,
199 | |     ) -> CostResult<(), Error>
    | |______________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
    = note: `#[warn(clippy::too_many_arguments)]` on by default

Check warning on line 156 in merk/src/tree/ops.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `value_defined_cost_fn`

warning: unused variable: `value_defined_cost_fn`
   --> merk/src/tree/ops.rs:156:9
    |
156 |         value_defined_cost_fn: Option<&impl Fn(&[u8]) -> Option<ValueDefinedCostType>>,
    |         ^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_value_defined_cost_fn`
    |
    = note: `#[warn(unused_variables)]` on by default

Check warning on line 39 in merk/src/tree/walk/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `CostContext`

warning: unused import: `CostContext`
  --> merk/src/tree/walk/mod.rs:39:43
   |
39 | use grovedb_costs::{cost_return_on_error, CostContext, CostResult, CostsExt, OperationCost};
   |                                           ^^^^^^^^^^^

Check warning on line 38 in merk/src/tree/commit.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `crate::tree::kv::ValueDefinedCostType`

warning: unused import: `crate::tree::kv::ValueDefinedCostType`
  --> merk/src/tree/commit.rs:38:5
   |
38 | use crate::tree::kv::ValueDefinedCostType;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^