Skip to content

feat: db state sync by merk chunking #459

feat: db state sync by merk chunking

feat: db state sync by merk chunking #459

GitHub Actions / clippy succeeded Apr 26, 2024 in 2s

clippy

74 warnings

Details

Results

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

Versions

  • rustc 1.77.2 (25ef9e3d8 2024-04-09)
  • cargo 1.77.2 (e52e36006 2024-03-26)
  • clippy 0.1.77 (25ef9e3 2024-04-09)

Annotations

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

See this annotation in the file changed.

@github-actions github-actions / clippy

variable `CHUNK_PREFIX_LENGTH` should have a snake case name

warning: variable `CHUNK_PREFIX_LENGTH` should have a snake case name
    --> grovedb/src/lib.rs:1376:9
     |
1376 |     let CHUNK_PREFIX_LENGTH: usize = 32;
     |         ^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `chunk_prefix_length`

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

See this annotation in the file changed.

@github-actions github-actions / clippy

variable `CHUNK_PREFIX_LENGTH` should have a snake case name

warning: variable `CHUNK_PREFIX_LENGTH` should have a snake case name
    --> grovedb/src/lib.rs:1146:13
     |
1146 |         let CHUNK_PREFIX_LENGTH: usize = 32;
     |             ^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `chunk_prefix_length`
     |
     = note: `#[warn(non_snake_case)]` on by default

Check warning on line 606 in /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/macros/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused `std::result::Result` that must be used

warning: unused `std::result::Result` that must be used
   --> grovedb/src/lib.rs:280:13
    |
280 | /             write!(
281 | |                 f,
282 | |                 " prefix:{:?} -> path:{:?}\n",
283 | |                 hex::encode(prefix),
284 | |                 metadata_path_str
285 | |             );
    | |_____________^
    |
    = note: this `Result` may be an `Err` variant, which should be handled
    = note: `#[warn(unused_must_use)]` on by default
    = note: this warning originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)

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

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
    --> grovedb/src/lib.rs:1391:13
     |
1391 | /             return Err(Error::CorruptedData(
1392 | |                 "unable to convert chunk id to string".to_string(),
1393 | |             ))
     | |______________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
     |
1391 ~             Err(Error::CorruptedData(
1392 +                 "unable to convert chunk id to string".to_string(),
1393 +             ))
     |

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

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary use of `to_vec`

warning: unnecessary use of `to_vec`
    --> grovedb/src/lib.rs:1365:20
     |
1365 |     for subtree in path.to_vec() {
     |                    ^^^^^^^^^^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned
     = note: `#[warn(clippy::unnecessary_to_owned)]` on by default
help: use
     |
1365 |     for subtree in path {
     |                    ~~~~
help: remove this `&`
     |
1366 -         let string = std::str::from_utf8(&subtree).unwrap();
1366 +         let string = std::str::from_utf8(subtree).unwrap();
     |

Check warning on line 1363 in grovedb/src/lib.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/lib.rs:1363:34
     |
1363 | pub fn util_path_to_string(path: &Vec<Vec<u8>>) -> Vec<String> {
     |                                  ^^^^^^^^^^^^^ help: change this to: `&[Vec<u8>]`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg

Check warning on line 1265 in grovedb/src/lib.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/lib.rs:1265:67
     |
1265 |         let (chunk_prefix, chunk_id) = util_split_global_chunk_id(&global_chunk_id)?;
     |                                                                   ^^^^^^^^^^^^^^^^ help: change this to: `global_chunk_id`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

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

See this annotation in the file changed.

@github-actions github-actions / clippy

this boolean expression can be simplified

warning: this boolean expression can be simplified
    --> grovedb/src/lib.rs:1315:28
     |
1315 |                         if (!restorer.finalize().is_ok()) {
     |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `restorer.finalize().is_err()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
     = note: `#[warn(clippy::nonminimal_bool)]` on by default

Check warning on line 1168 in grovedb/src/lib.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/lib.rs:1168:67
     |
1168 |                     .open_transactional_merk_at_path(path.into(), &tx, None)
     |                                                                   ^^^ help: change this to: `tx`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 1159 in grovedb/src/lib.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/lib.rs:1159:60
     |
1159 |         let subtrees_metadata = self.get_subtrees_metadata(&tx)?;
     |                                                            ^^^ help: change this to: `tx`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

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

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
    --> grovedb/src/lib.rs:1197:17
     |
1197 |                 return Err(Error::CorruptedData("Prefix not found".to_string()));
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
     |
1197 -                 return Err(Error::CorruptedData("Prefix not found".to_string()));
1197 +                 Err(Error::CorruptedData("Prefix not found".to_string()))
     |

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

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
    --> grovedb/src/lib.rs:1190:25
     |
1190 | /                         return Err(Error::CorruptedData(
1191 | |                             "Unable to create Chunk producer".to_string(),
1192 | |                         ));
     | |__________________________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
     |
1190 ~                         Err(Error::CorruptedData(
1191 +                             "Unable to create Chunk producer".to_string(),
1192 ~                         ))
     |

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

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
    --> grovedb/src/lib.rs:1183:33
     |
1183 | / ...                   return Err(Error::CorruptedData(
1184 | | ...                       "Unable to create to load chunk".to_string(),
1185 | | ...                   ));
     | |________________________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
     = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
     |
1183 ~                                 Err(Error::CorruptedData(
1184 +                                     "Unable to create to load chunk".to_string(),
1185 ~                                 ))
     |

Check warning on line 1006 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:1006:10
     |
1006 |     ) -> 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 936 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:936:10
    |
936 |     ) -> 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 910 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:910:10
    |
910 |     ) -> 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 285 in grovedb/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `write!()` with a format string that ends in a single newline

warning: using `write!()` with a format string that ends in a single newline
   --> grovedb/src/lib.rs:280:13
    |
280 | /             write!(
281 | |                 f,
282 | |                 " prefix:{:?} -> path:{:?}\n",
283 | |                 hex::encode(prefix),
284 | |                 metadata_path_str
285 | |             );
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#write_with_newline
    = note: `#[warn(clippy::write_with_newline)]` on by default
help: use `writeln!` instead
    |
280 ~             writeln!(
281 |                 f,
282 ~                 " prefix:{:?} -> path:{:?}",
    |

Check warning on line 279 in grovedb/src/lib.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/lib.rs:279:57
    |
279 |             let metadata_path_str = util_path_to_string(&metadata_path);
    |                                                         ^^^^^^^^^^^^^^ help: change this to: `metadata_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 272 in grovedb/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you should consider adding a `Default` implementation for `SubtreesMetadata`

warning: you should consider adding a `Default` implementation for `SubtreesMetadata`
   --> grovedb/src/lib.rs:268:5
    |
268 | /     pub fn new() -> SubtreesMetadata {
269 | |         SubtreesMetadata {
270 | |             data: BTreeMap::new(),
271 | |         }
272 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
    = note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
    |
267 + impl Default for SubtreesMetadata {
268 +     fn default() -> Self {
269 +         Self::new()
270 +     }
271 + }
    |

Check warning on line 498 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:488:5
    |
488 | /     fn generate_and_store_merk_proof<'a, S, B>(
489 | |         &self,
490 | |         path: &SubtreePath<B>,
491 | |         subtree: &'a Merk<S>,
...   |
497 | |         key: &[u8],
498 | |     ) -> 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 558 in grovedb/src/element/query.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (11/7)

warning: this function has too many arguments (11/7)
   --> grovedb/src/element/query.rs:546:5
    |
546 | /     fn query_item(
547 | |         storage: &RocksDbStorage,
548 | |         item: &QueryItem,
549 | |         results: &mut Vec<QueryResultElement>,
...   |
557 | |         add_element_function: fn(PathQueryPushArgs) -> CostResult<(), Error>,
558 | |     ) -> 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 321 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:319:9
    |
319 | /         let Some(value_cost) = self.get_specialized_cost().ok() else {
320 | |             return None;
321 | |         };
    | |__________^ help: replace it with: `let value_cost = self.get_specialized_cost().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 248 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:248:14
    |
248 |         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

Check warning on line 555 in grovedb/src/batch/mod.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/batch/mod.rs:555:50
    |
555 |     pub fn verify_consistency_of_operations(ops: &Vec<GroveDbOp>) -> GroveDbOpConsistencyResults {
    |                                                  ^^^^^^^^^^^^^^^ help: change this to: `&[GroveDbOp]`
    |
    = 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