Skip to content

feat: sync multiple subtrees #476

feat: sync multiple subtrees

feat: sync multiple subtrees #476

GitHub Actions / clippy succeeded May 8, 2024 in 0s

clippy

40 warnings

Details

Results

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

Versions

  • rustc 1.78.0 (9b00956e5 2024-04-29)
  • cargo 1.78.0 (54d8815d0 2024-03-26)
  • clippy 0.1.78 (9b00956 2024-04-29)

Annotations

Check warning on line 670 in /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/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/replication.rs:71:13
   |
71 | /             writeln!(
72 | |                 f,
73 | |                 " prefix:{:?} -> path:{:?}",
74 | |                 hex::encode(prefix),
75 | |                 metadata_path_str
76 | |             );
   | |_____________^
   |
   = 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 `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 344 in grovedb/src/replication.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `vec!`

warning: useless use of `vec!`
   --> grovedb/src/replication.rs:344:46
    |
344 |             replication::util_path_to_string(&vec![])
    |                                              ^^^^^^^ help: you can use a slice directly: `&[]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
    = note: `#[warn(clippy::useless_vec)]` on by default

Check warning on line 941 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:941:10
    |
941 |     ) -> 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 871 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:871:10
    |
871 |     ) -> 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 845 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:845:10
    |
845 |     ) -> 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 483 in grovedb/src/replication.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/replication.rs:483:50
    |
483 |                     match restorer.process_chunk(&chunk_id, chunk_data) {
    |                                                  ^^^^^^^^^ help: change this to: `chunk_id`
    |
    = 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 456 in grovedb/src/replication.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> grovedb/src/replication.rs:456:13
    |
456 |             return Err(Error::InternalError("Invalid incoming prefix"));
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
456 -             return Err(Error::InternalError("Invalid incoming prefix"));
456 +             Err(Error::InternalError("Invalid incoming prefix"))
    |

Check warning on line 452 in grovedb/src/replication.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> grovedb/src/replication.rs:452:17
    |
452 |                 return Err(Error::InternalError("Unable to process incoming chunk"));
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
452 -                 return Err(Error::InternalError("Unable to process incoming chunk"));
452 +                 Err(Error::InternalError("Unable to process incoming chunk"))
    |

Check warning on line 445 in grovedb/src/replication.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> grovedb/src/replication.rs:445:33
    |
445 | ...                   return Err(Error::InternalError("Unable to discover Subtrees"));
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
445 -                                 return Err(Error::InternalError("Unable to discover Subtrees"));
445 +                                 Err(Error::InternalError("Unable to discover Subtrees"))
    |

Check warning on line 421 in grovedb/src/replication.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> grovedb/src/replication.rs:421:29
    |
421 | ...                   return Err(Error::InternalError("Unable to finalize subtree"));
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = 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`
    |
421 -                             return Err(Error::InternalError("Unable to finalize subtree"));
421 +                             Err(Error::InternalError("Unable to finalize subtree"))
    |

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

See this annotation in the file changed.

@github-actions github-actions / clippy

assigning the result of `ToOwned::to_owned()` may be inefficient

warning: assigning the result of `ToOwned::to_owned()` may be inefficient
   --> grovedb/src/operations/proof/verify.rs:577:17
    |
577 |                 *current_value_bytes = subquery_path_result_set[0].value.to_owned();
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `subquery_path_result_set[0].value.clone_into(current_value_bytes)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
    = note: `#[warn(clippy::assigning_clones)]` on by default

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
    = note: `#[warn(clippy::ptr_arg)]` on by default

Check warning on line 242 in grovedb/src/batch/estimated_costs/worst_case_costs.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary use of `get(&base_path).is_none()`

warning: unnecessary use of `get(&base_path).is_none()`
   --> grovedb/src/batch/estimated_costs/worst_case_costs.rs:242:34
    |
242 |             if self.cached_merks.get(&base_path).is_none() {
    |                ------------------^^^^^^^^^^^^^^^^^^^^^^^^^
    |                |
    |                help: replace it with: `!self.cached_merks.contains(&base_path)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check

Check warning on line 217 in grovedb/src/batch/estimated_costs/worst_case_costs.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary use of `get(path).is_none()`

warning: unnecessary use of `get(path).is_none()`
   --> grovedb/src/batch/estimated_costs/worst_case_costs.rs:217:30
    |
217 |         if self.cached_merks.get(path).is_none() {
    |            ------------------^^^^^^^^^^^^^^^^^^^
    |            |
    |            help: replace it with: `!self.cached_merks.contains(path)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check

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

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary use of `get(&base_path).is_none()`

warning: unnecessary use of `get(&base_path).is_none()`
   --> grovedb/src/batch/estimated_costs/average_case_costs.rs:277:34
    |
277 |             if self.cached_merks.get(&base_path).is_none() {
    |                ------------------^^^^^^^^^^^^^^^^^^^^^^^^^
    |                |
    |                help: replace it with: `!self.cached_merks.contains_key(&base_path)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check

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

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary use of `get(path).is_none()`

warning: unnecessary use of `get(path).is_none()`
   --> grovedb/src/batch/estimated_costs/average_case_costs.rs:231:30
    |
231 |         if self.cached_merks.get(path).is_none() {
    |            ------------------^^^^^^^^^^^^^^^^^^^
    |            |
    |            help: replace it with: `!self.cached_merks.contains_key(path)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check
    = note: `#[warn(clippy::unnecessary_get_then_check)]` on by default

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> {
   |        ^^^^^^^^^^^^^^^^^^

Check warning on line 46 in grovedb/src/batch/mode.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variants `Execute`, `AverageCase`, and `WorstCase` are never constructed

warning: variants `Execute`, `AverageCase`, and `WorstCase` are never constructed
  --> grovedb/src/batch/mode.rs:46:5
   |
45 | pub enum BatchRunMode {
   |          ------------ variants in this enum
46 |     Execute,
   |     ^^^^^^^
47 |     #[cfg(feature = "estimated_costs")]
48 |     AverageCase(HashMap<KeyInfoPath, EstimatedLayerInformation>),
   |     ^^^^^^^^^^^
49 |     #[cfg(feature = "estimated_costs")]
50 |     WorstCase(HashMap<KeyInfoPath, WorstCaseLayerInformation>),
   |     ^^^^^^^^^
   |
   = note: `BatchRunMode` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis

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

See this annotation in the file changed.

@github-actions github-actions / clippy

method `get_batch_run_mode` is never used

warning: method `get_batch_run_mode` is never used
   --> grovedb/src/batch/mod.rs:686:8
    |
683 | trait TreeCache<G, SR> {
    |       --------- method in this trait
...
686 |     fn get_batch_run_mode(&self) -> BatchRunMode;
    |        ^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

Check warning on line 116 in grovedb/src/replication.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

type `replication::SubtreeStateSyncInfo<'_>` is more private than the item `replication::<impl GroveDb>::create_subtree_state_sync_info`

warning: type `replication::SubtreeStateSyncInfo<'_>` is more private than the item `replication::<impl GroveDb>::create_subtree_state_sync_info`
   --> grovedb/src/replication.rs:116:5
    |
116 |     pub fn create_subtree_state_sync_info(&self) -> SubtreeStateSyncInfo {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method `replication::<impl GroveDb>::create_subtree_state_sync_info` is reachable at visibility `pub`
    |
note: but type `replication::SubtreeStateSyncInfo<'_>` is only usable at visibility `pub(self)`
   --> grovedb/src/replication.rs:23:1
    |
23  | struct SubtreeStateSyncInfo<'db> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 37 in grovedb/src/replication.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

type `replication::SubtreeStateSyncInfo<'db>` is more private than the item `replication::MultiStateSyncInfo::current_prefixes`

warning: type `replication::SubtreeStateSyncInfo<'db>` is more private than the item `replication::MultiStateSyncInfo::current_prefixes`
  --> grovedb/src/replication.rs:37:5
   |
37 |     pub current_prefixes: BTreeMap<SubtreePrefix, SubtreeStateSyncInfo<'db>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `replication::MultiStateSyncInfo::current_prefixes` is reachable at visibility `pub`
   |
note: but type `replication::SubtreeStateSyncInfo<'db>` is only usable at visibility `pub(self)`
  --> grovedb/src/replication.rs:23:1
   |
23 | struct SubtreeStateSyncInfo<'db> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: `#[warn(private_interfaces)]` on by default