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

feat: added a convenience method that will return an existing item du… #342

Merged
merged 6 commits into from
Sep 27, 2024

added unit tests

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

feat: added a convenience method that will return an existing item du… #342

added unit tests
2452190
Select commit
Loading
Failed to load commit list.
GitHub Actions / clippy succeeded Sep 27, 2024 in 0s

clippy

71 warnings

Details

Results

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

Versions

  • rustc 1.81.0 (eeb90cda1 2024-09-04)
  • cargo 1.81.0 (2dbb1af80 2024-08-20)
  • clippy 0.1.81 (eeb90cd 2024-09-04)

Annotations

Check warning on line 1126 in grovedb/src/lib.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/lib.rs:1117:5
     |
1117 | /     fn verify_merk_and_submerks_in_transaction<'db, B: AsRef<[u8]>, S: StorageContext<'db>>(
1118 | |         &'db self,
1119 | |         merk: Merk<S>,
1120 | |         path: &SubtreePath<B>,
...    |
1125 | |         grove_version: &GroveVersion,
1126 | |     ) -> Result<HashMap<Vec<Vec<u8>>, (CryptoHash, CryptoHash, CryptoHash)>, Error> {
     | |___________________________________________________________________________________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 1126 in grovedb/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions
    --> grovedb/src/lib.rs:1126:10
     |
1126 |     ) -> Result<HashMap<Vec<Vec<u8>>, (CryptoHash, CryptoHash, CryptoHash)>, Error> {
     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

Check warning on line 982 in grovedb/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions
   --> grovedb/src/lib.rs:982:10
    |
982 |     ) -> Result<HashMap<Vec<Vec<u8>>, (CryptoHash, CryptoHash, CryptoHash)>, Error> {
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

Check warning on line 938 in grovedb/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions
   --> grovedb/src/lib.rs:938:10
    |
938 |     ) -> Result<HashMap<Vec<Vec<u8>>, (CryptoHash, CryptoHash, CryptoHash)>, Error> {
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
    = note: `#[warn(clippy::type_complexity)]` on by default

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

See this annotation in the file changed.

@github-actions github-actions / clippy

called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`

warning: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
   --> grovedb/src/operations/proof/verify.rs:367:25
    |
367 |                         limit_left.as_mut().map(|limit| *limit -= 1);
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
    |                         |
    |                         help: try: `if let Some(limit) = limit_left.as_mut() { ... }`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn

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

See this annotation in the file changed.

@github-actions github-actions / clippy

called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`

warning: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
   --> grovedb/src/operations/proof/verify.rs:293:17
    |
293 |                 limit_left.as_mut().map(|limit| *limit -= 1);
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
    |                 |
    |                 help: try: `if let Some(limit) = limit_left.as_mut() { ... }`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
    = note: `#[warn(clippy::option_map_unit_fn)]` on by default

Check warning on line 238 in grovedb/src/operations/proof/verify.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/verify.rs:229:5
    |
229 | /     fn verify_layer_proof<T>(
230 | |         layer_proof: &LayerProof,
231 | |         prove_options: &ProveOptions,
232 | |         query: &PathQuery,
...   |
237 | |         grove_version: &GroveVersion,
238 | |     ) -> Result<CryptoHash, Error>
    | |__________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 226 in grovedb/src/operations/insert/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)
   --> grovedb/src/operations/insert/mod.rs:217:5
    |
217 | /     fn add_element_on_transaction<'db, B: AsRef<[u8]>>(
218 | |         &'db self,
219 | |         path: SubtreePath<B>,
220 | |         key: &[u8],
...   |
225 | |         grove_version: &GroveVersion,
226 | |     ) -> CostResult<Merk<PrefixedRocksDbTransactionContext<'db>>, Error> {
    | |________________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 126 in grovedb/src/operations/insert/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)
   --> grovedb/src/operations/insert/mod.rs:117:5
    |
117 | /     fn insert_on_transaction<'db, 'b, B: AsRef<[u8]>>(
118 | |         &self,
119 | |         path: SubtreePath<'b, B>,
120 | |         key: &[u8],
...   |
125 | |         grove_version: &GroveVersion,
126 | |     ) -> CostResult<(), Error> {
    | |______________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 551 in grovedb/src/operations/get/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/operations/get/query.rs:542:5
    |
542 | /     pub fn query_raw(
543 | |         &self,
544 | |         path_query: &PathQuery,
545 | |         allow_cache: bool,
...   |
550 | |         grove_version: &GroveVersion,
551 | |     ) -> CostResult<(QueryResultElements, u16), Error> {
    | |______________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 240 in grovedb/src/operations/get/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/operations/get/query.rs:231:5
    |
231 | /     pub fn query(
232 | |         &self,
233 | |         path_query: &PathQuery,
234 | |         allow_cache: bool,
...   |
239 | |         grove_version: &GroveVersion,
240 | |     ) -> CostResult<(QueryResultElements, u16), Error> {
    | |______________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 123 in grovedb/src/operations/get/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/operations/get/query.rs:114:5
    |
114 | /     pub fn query_many_raw(
115 | |         &self,
116 | |         path_queries: &[&PathQuery],
117 | |         allow_cache: bool,
...   |
122 | |         grove_version: &GroveVersion,
123 | |     ) -> CostResult<QueryResultElements, Error>
    | |_______________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 689 in grovedb/src/operations/delete/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)
   --> grovedb/src/operations/delete/mod.rs:673:5
    |
673 | /     fn delete_internal_on_transaction<B: AsRef<[u8]>>(
674 | |         &self,
675 | |         path: SubtreePath<B>,
676 | |         key: &[u8],
...   |
688 | |         grove_version: &GroveVersion,
689 | |     ) -> CostResult<bool, Error> {
    | |________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 650 in grovedb/src/operations/delete/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)
   --> grovedb/src/operations/delete/mod.rs:634:5
    |
634 | /     fn delete_internal<B: AsRef<[u8]>>(
635 | |         &self,
636 | |         path: SubtreePath<B>,
637 | |         key: &[u8],
...   |
649 | |         grove_version: &GroveVersion,
650 | |     ) -> CostResult<bool, Error> {
    | |________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 518 in grovedb/src/operations/delete/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)
   --> grovedb/src/operations/delete/mod.rs:509:5
    |
509 | /     pub fn delete_operation_for_delete_internal<B: AsRef<[u8]>>(
510 | |         &self,
511 | |         path: SubtreePath<B>,
512 | |         key: &[u8],
...   |
517 | |         grove_version: &GroveVersion,
518 | |     ) -> CostResult<Option<QualifiedGroveDbOp>, Error> {
    | |______________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 130 in grovedb/src/operations/delete/worst_case.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/delete/worst_case.rs:121:5
    |
121 | /     pub fn worst_case_delete_operation_for_delete<'db, S: Storage<'db>>(
122 | |         path: &KeyInfoPath,
123 | |         key: &KeyInfo,
124 | |         parent_tree_is_sum_tree: bool,
...   |
129 | |         grove_version: &GroveVersion,
130 | |     ) -> CostResult<QualifiedGroveDbOp, Error> {
    | |______________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 208 in grovedb/src/operations/delete/delete_up_tree.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/delete/delete_up_tree.rs:199:5
    |
199 | /     pub fn add_delete_operations_for_delete_up_tree_while_empty<B: AsRef<[u8]>>(
200 | |         &self,
201 | |         path: SubtreePath<B>,
202 | |         key: &[u8],
...   |
207 | |         grove_version: &GroveVersion,
208 | |     ) -> CostResult<Option<Vec<QualifiedGroveDbOp>>, Error> {
    | |___________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 176 in grovedb/src/operations/delete/delete_up_tree.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/delete/delete_up_tree.rs:167:5
    |
167 | /     pub fn delete_operations_for_delete_up_tree_while_empty<B: AsRef<[u8]>>(
168 | |         &self,
169 | |         path: SubtreePath<B>,
170 | |         key: &[u8],
...   |
175 | |         grove_version: &GroveVersion,
176 | |     ) -> CostResult<Vec<QualifiedGroveDbOp>, Error> {
    | |___________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 148 in grovedb/src/operations/delete/average_case.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/delete/average_case.rs:139:5
    |
139 | /     pub fn average_case_delete_operation_for_delete<'db, S: Storage<'db>>(
140 | |         path: &KeyInfoPath,
141 | |         key: &KeyInfo,
142 | |         parent_tree_is_sum_tree: bool,
...   |
147 | |         grove_version: &GroveVersion,
148 | |     ) -> CostResult<QualifiedGroveDbOp, Error> {
    | |______________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 743 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:730:5
    |
730 | /     fn query_item(
731 | |         storage: &RocksDbStorage,
732 | |         item: &QueryItem,
733 | |         results: &mut Vec<QueryResultElement>,
...   |
742 | |         grove_version: &GroveVersion,
743 | |     ) -> CostResult<(), Error> {
    | |______________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 312 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:303:5
    |
303 | /     pub fn get_query_apply_function(
304 | |         storage: &RocksDbStorage,
305 | |         path: &[&[u8]],
306 | |         sized_query: &SizedQuery,
...   |
311 | |         grove_version: &GroveVersion,
312 | |     ) -> CostResult<(QueryResultElements, u16), Error> {
    | |______________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 330 in grovedb/src/element/helpers.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `let...else` may be rewritten with the `?` operator

warning: this `let...else` may be rewritten with the `?` operator
   --> grovedb/src/element/helpers.rs:328:9
    |
328 | /         let Some(value_cost) = self.get_specialized_cost(grove_version).ok() else {
329 | |             return None;
330 | |         };
    | |__________^ help: replace it with: `let value_cost = self.get_specialized_cost(grove_version).ok()?;`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
    = note: `#[warn(clippy::question_mark)]` on by default

Check warning on line 253 in grovedb/src/element/helpers.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

writing `&Vec` instead of `&[_]` involves a new object where a slice will do

warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
   --> grovedb/src/element/helpers.rs:253:14
    |
253 |         key: &Vec<u8>,
    |              ^^^^^^^^ help: change this to: `&[u8]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
    = note: `#[warn(clippy::ptr_arg)]` on by default

Check warning on line 2470 in grovedb/src/batch/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)
    --> grovedb/src/batch/mod.rs:2447:5
     |
2447 | /     pub fn apply_partial_batch_with_element_flags_update(
2448 | |         &self,
2449 | |         ops: Vec<QualifiedGroveDbOp>,
2450 | |         batch_apply_options: Option<BatchApplyOptions>,
...    |
2469 | |         grove_version: &GroveVersion,
2470 | |     ) -> CostResult<(), Error> {
     | |______________________________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 1995 in grovedb/src/batch/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)
    --> grovedb/src/batch/mod.rs:1975:5
     |
1975 | /     fn continue_partial_apply_body<'db, S: StorageContext<'db>>(
1976 | |         &self,
1977 | |         previous_leftover_operations: Option<OpsByLevelPath>,
1978 | |         additional_ops: Vec<QualifiedGroveDbOp>,
...    |
1994 | |         grove_version: &GroveVersion,
1995 | |     ) -> CostResult<Option<OpsByLevelPath>, Error> {
     | |__________________________________________________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments