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: bidirectional references and cleanup #345

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from

wip

f382038
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Draft

feat: bidirectional references and cleanup #345

wip
f382038
Select commit
Loading
Failed to load commit list.
GitHub Actions / clippy failed Dec 11, 2024 in 2s

clippy

2 errors, 148 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 2
Warning 148
Note 0
Help 0

Versions

  • rustc 1.83.0 (90b35a623 2024-11-26)
  • cargo 1.83.0 (5ffbef321 2024-10-29)
  • clippy 0.1.83 (90b35a6 2024-11-26)

Annotations

Check failure on line 85 in node-grove/src/converter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

non-exhaustive patterns: `grovedb::Element::BidirectionalReference(_, _, _, _)`, `grovedb::Element::ItemWithBackwardsReferences(_, _, _)` and `grovedb::Element::SumItemWithBackwardsReferences(_, _, _)` not covered

error[E0004]: non-exhaustive patterns: `grovedb::Element::BidirectionalReference(_, _, _, _)`, `grovedb::Element::ItemWithBackwardsReferences(_, _, _)` and `grovedb::Element::SumItemWithBackwardsReferences(_, _, _)` not covered
  --> node-grove/src/converter.rs:85:43
   |
85 |     let js_value: Handle<JsValue> = match element {
   |                                           ^^^^^^^ patterns `grovedb::Element::BidirectionalReference(_, _, _, _)`, `grovedb::Element::ItemWithBackwardsReferences(_, _, _)` and `grovedb::Element::SumItemWithBackwardsReferences(_, _, _)` not covered
   |
note: `grovedb::Element` defined here
  --> /home/runner/work/grovedb/grovedb/grovedb/src/element/mod.rs:75:1
   |
75 | pub enum Element {
   | ^^^^^^^^^^^^^^^^
...
89 |     BidirectionalReference(
   |     ---------------------- not covered
...
96 |     ItemWithBackwardsReferences(Vec<u8>, Vec<BackwardReference>, Option<ElementFlags>),
   |     --------------------------- not covered
...
99 |     SumItemWithBackwardsReferences(SumValue, Vec<BackwardReference>, Option<ElementFlags>),
   |     ------------------------------ not covered
   = note: the matched value is of type `grovedb::Element`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
   |
94 ~         Element::SumTree(..) => nested_vecs_to_js(vec![], cx)?,
95 ~         grovedb::Element::BidirectionalReference(_, _, _, _) | grovedb::Element::ItemWithBackwardsReferences(_, _, _) | grovedb::Element::SumItemWithBackwardsReferences(_, _, _) => todo!(),
   |

Check failure on line 35 in node-grove/src/converter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

non-exhaustive patterns: `grovedb::Element::BidirectionalReference(_, _, _, _)`, `grovedb::Element::ItemWithBackwardsReferences(_, _, _)` and `grovedb::Element::SumItemWithBackwardsReferences(_, _, _)` not covered

error[E0004]: non-exhaustive patterns: `grovedb::Element::BidirectionalReference(_, _, _, _)`, `grovedb::Element::ItemWithBackwardsReferences(_, _, _)` and `grovedb::Element::SumItemWithBackwardsReferences(_, _, _)` not covered
  --> node-grove/src/converter.rs:35:11
   |
35 |     match element {
   |           ^^^^^^^ patterns `grovedb::Element::BidirectionalReference(_, _, _, _)`, `grovedb::Element::ItemWithBackwardsReferences(_, _, _)` and `grovedb::Element::SumItemWithBackwardsReferences(_, _, _)` not covered
   |
note: `grovedb::Element` defined here
  --> /home/runner/work/grovedb/grovedb/grovedb/src/element/mod.rs:75:1
   |
75 | pub enum Element {
   | ^^^^^^^^^^^^^^^^
...
89 |     BidirectionalReference(
   |     ---------------------- not covered
...
96 |     ItemWithBackwardsReferences(Vec<u8>, Vec<BackwardReference>, Option<ElementFlags>),
   |     --------------------------- not covered
...
99 |     SumItemWithBackwardsReferences(SumValue, Vec<BackwardReference>, Option<ElementFlags>),
   |     ------------------------------ not covered
   = note: the matched value is of type `grovedb::Element`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
   |
40 ~         Element::SumTree(..) => "sum_tree".to_string(),
41 ~         grovedb::Element::BidirectionalReference(_, _, _, _) | grovedb::Element::ItemWithBackwardsReferences(_, _, _) | grovedb::Element::SumItemWithBackwardsReferences(_, _, _) => todo!(),
   |

Check warning on line 738 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:729:5
    |
729 | /     fn verify_merk_and_submerks_in_transaction<'db, B: AsRef<[u8]>, S: StorageContext<'db>>(
730 | |         &'db self,
731 | |         merk: Merk<S>,
732 | |         path: &SubtreePath<B>,
...   |
737 | |         grove_version: &GroveVersion,
738 | |     ) -> 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 738 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:738:10
    |
738 |     ) -> 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 714 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:714:10
    |
714 |     ) -> 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 47 in grovedb/src/util.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
  --> grovedb/src/util.rs:47:6
   |
47 | impl<'a, 'db> AsRef<Transaction<'db>> for TxRef<'a, 'db> {
   |      ^^                                         ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
47 - impl<'a, 'db> AsRef<Transaction<'db>> for TxRef<'a, 'db> {
47 + impl<'db> AsRef<Transaction<'db>> for TxRef<'_, 'db> {
   |

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

See this annotation in the file changed.

@github-actions github-actions / clippy

the following explicit lifetimes could be elided: 'db

warning: the following explicit lifetimes could be elided: 'db
  --> grovedb/src/replication.rs:49:6
   |
49 | impl<'db> Default for MultiStateSyncInfo<'db> {
   |      ^^^                                 ^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
49 - impl<'db> Default for MultiStateSyncInfo<'db> {
49 + impl Default for MultiStateSyncInfo<'_> {
   |

Check warning on line 512 in grovedb/src/query/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
   --> grovedb/src/query/mod.rs:512:6
    |
512 | impl<'a> fmt::Display for SinglePathSubquery<'a> {
    |      ^^                                      ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
512 - impl<'a> fmt::Display for SinglePathSubquery<'a> {
512 + impl fmt::Display for SinglePathSubquery<'_> {
    |

Check warning on line 483 in grovedb/src/query/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
   --> grovedb/src/query/mod.rs:483:6
    |
483 | impl<'a> HasSubquery<'a> {
    |      ^^              ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
483 - impl<'a> HasSubquery<'a> {
483 + impl HasSubquery<'_> {
    |

Check warning on line 467 in grovedb/src/query/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
   --> grovedb/src/query/mod.rs:467:6
    |
467 | impl<'a> fmt::Display for HasSubquery<'a> {
    |      ^^                               ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
467 - impl<'a> fmt::Display for HasSubquery<'a> {
467 + impl fmt::Display for HasSubquery<'_> {
    |

Check warning on line 370 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:370:25
    |
370 |                         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 218 in grovedb/src/operations/proof/generate.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/proof/generate.rs:218:74
    |
218 |             self.open_transactional_merk_at_path(path.as_slice().into(), &tx, None, grove_version)
    |                                                                          ^^^ 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 78 in grovedb/src/operations/insert/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/insert/mod.rs:78:41
   |
78 |         let merk_cache = MerkCache::new(&self, tx.as_ref(), grove_version);
   |                                         ^^^^^ help: change this to: `self`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 574 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:565:5
    |
565 | /     pub fn query_raw(
566 | |         &self,
567 | |         path_query: &PathQuery,
568 | |         allow_cache: bool,
...   |
573 | |         grove_version: &GroveVersion,
574 | |     ) -> 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 246 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:237:5
    |
237 | /     pub fn query(
238 | |         &self,
239 | |         path_query: &PathQuery,
240 | |         allow_cache: bool,
...   |
245 | |         grove_version: &GroveVersion,
246 | |     ) -> 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 124 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:115:5
    |
115 | /     pub fn query_many_raw(
116 | |         &self,
117 | |         path_queries: &[&PathQuery],
118 | |         allow_cache: bool,
...   |
123 | |         grove_version: &GroveVersion,
124 | |     ) -> 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 597 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:581:5
    |
581 | /     fn delete_internal<B: AsRef<[u8]>>(
582 | |         &self,
583 | |         path: SubtreePath<B>,
584 | |         key: &[u8],
...   |
596 | |         grove_version: &GroveVersion,
597 | |     ) -> 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 457 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:448:5
    |
448 | /     pub fn delete_operation_for_delete_internal<B: AsRef<[u8]>>(
449 | |         &self,
450 | |         path: SubtreePath<B>,
451 | |         key: &[u8],
...   |
456 | |         grove_version: &GroveVersion,
457 | |     ) -> 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 173 in grovedb/src/merk_cache.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the following explicit lifetimes could be elided: 'c

warning: the following explicit lifetimes could be elided: 'c
   --> grovedb/src/merk_cache.rs:173:11
    |
173 | impl<'db, 'c> MerkHandle<'db, 'c> {
    |           ^^                  ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
173 - impl<'db, 'c> MerkHandle<'db, 'c> {
173 + impl<'db> MerkHandle<'db, '_> {
    |