feat!: proof system v1 (from v0.1) #315
clippy
42 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 42 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.79.0 (129f3b996 2024-06-10)
- cargo 1.79.0 (ffa9cf99a 2024-06-03)
- clippy 0.1.79 (129f3b9 2024-06-10)
Annotations
github-actions / clippy
unused `std::result::Result` that must be used
warning: unused `std::result::Result` that must be used
--> grovedb/src/replication.rs:86:13
|
86 | / writeln!(
87 | | f,
88 | | " prefix:{:?} -> path:{:?}",
89 | | hex::encode(prefix),
90 | | metadata_path_str
91 | | );
| |_____________^
|
= 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 958 in grovedb/src/lib.rs
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:958:10
|
958 | ) -> 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 888 in grovedb/src/lib.rs
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:888:10
|
888 | ) -> 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 862 in grovedb/src/lib.rs
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:862:10
|
862 | ) -> 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 335 in grovedb/src/query_result_type.rs
github-actions / clippy
use of `or_insert_with` to construct default value
warning: use of `or_insert_with` to construct default value
--> grovedb/src/query_result_type.rs:335:37
|
335 | map.entry(last).or_insert_with(Vec::new).push(element);
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
Check warning on line 285 in grovedb/src/query_result_type.rs
github-actions / clippy
use of `or_insert_with` to construct default value
warning: use of `or_insert_with` to construct default value
--> grovedb/src/query_result_type.rs:285:37
|
285 | map.entry(last).or_insert_with(Vec::new).push(key);
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
= note: `#[warn(clippy::unwrap_or_default)]` on by default
Check warning on line 326 in grovedb/src/operations/proof/verify.rs
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:326:25
|
326 | 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 253 in grovedb/src/operations/proof/verify.rs
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:253:17
|
253 | 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 308 in grovedb/src/operations/proof/util.rs
github-actions / clippy
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> grovedb/src/operations/proof/util.rs:308:10
|
308 | path.into_iter()
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
= note: `#[warn(clippy::into_iter_on_ref)]` on by default
Check warning on line 371 in grovedb/src/operations/proof/generate.rs
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/operations/proof/generate.rs:371:22
|
371 | query_items: &Vec<QueryItem>,
| ^^^^^^^^^^^^^^^ help: change this to: `&[QueryItem]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
Check warning on line 353 in grovedb/src/operations/proof/generate.rs
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/generate.rs:353:13
|
353 | overall_limit.as_mut().map(|limit| *limit -= 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try: `if let Some(limit) = overall_limit.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 348 in grovedb/src/operations/proof/generate.rs
github-actions / clippy
deref which would be done by auto-deref
warning: deref which would be done by auto-deref
--> grovedb/src/operations/proof/generate.rs:348:47
|
348 | .map(|a| hex_to_ascii(*a))
| ^^ help: try: `a`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
Check warning on line 321 in grovedb/src/operations/proof/generate.rs
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/generate.rs:321:33
|
321 | ... overall_limit.as_mut().map(|limit| *limit -= 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try: `if let Some(limit) = overall_limit.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 270 in grovedb/src/operations/proof/generate.rs
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/generate.rs:270:33
|
270 | ... overall_limit.as_mut().map(|limit| *limit -= 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try: `if let Some(limit) = overall_limit.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 261 in grovedb/src/operations/proof/generate.rs
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/generate.rs:261:33
|
261 | ... overall_limit.as_mut().map(|limit| *limit -= 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try: `if let Some(limit) = overall_limit.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 202 in grovedb/src/operations/proof/generate.rs
github-actions / clippy
deref which would be done by auto-deref
warning: deref which would be done by auto-deref
--> grovedb/src/operations/proof/generate.rs:202:43
|
202 | .map(|a| hex_to_ascii(*a))
| ^^ help: try: `a`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
Check warning on line 173 in grovedb/src/operations/proof/generate.rs
github-actions / clippy
deref which would be done by auto-deref
warning: deref which would be done by auto-deref
--> grovedb/src/operations/proof/generate.rs:173:47
|
173 | .map(|a| hex_to_ascii(*a))
| ^^ help: try: `a`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
= note: `#[warn(clippy::explicit_auto_deref)]` on by default
Check warning on line 704 in grovedb/src/element/query.rs
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:692:5
|
692 | / fn query_item(
693 | | storage: &RocksDbStorage,
694 | | item: &QueryItem,
695 | | results: &mut Vec<QueryResultElement>,
... |
703 | | add_element_function: fn(PathQueryPushArgs) -> CostResult<(), Error>,
704 | | ) -> 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 377 in grovedb/src/element/helpers.rs
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:375:9
|
375 | / let Some(value_cost) = self.get_specialized_cost().ok() else {
376 | | return None;
377 | | };
| |__________^ 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 304 in grovedb/src/element/helpers.rs
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:304:14
|
304 | 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 30 in grovedb/src/debugger.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> grovedb/src/debugger.rs:30:34
|
30 | fs::write(&grovedbg_zip, &GROVEDBG_ZIP).expect("cannot crate grovedbg.zip");
| ^^^^^^^^^^^^^ help: change this to: `GROVEDBG_ZIP`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
Check warning on line 288 in grovedb/src/batch/estimated_costs/average_case_costs.rs
github-actions / clippy
usage of `contains_key` followed by `insert` on a `HashMap`
warning: usage of `contains_key` followed by `insert` on a `HashMap`
--> grovedb/src/batch/estimated_costs/average_case_costs.rs:277:13
|
277 | / if !self.cached_merks.contains_key(&base_path) {
278 | | GroveDb::add_average_case_get_merk_at_path::<RocksDbStorage>(
279 | | &mut cost,
280 | | &base_path,
... |
287 | | .insert(base_path, estimated_layer_info.is_sum_tree);
288 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry
= note: `#[warn(clippy::map_entry)]` on by default
help: try
|
277 ~ self.cached_merks.entry(base_path).or_insert_with(|| {
278 + GroveDb::add_average_case_get_merk_at_path::<RocksDbStorage>(
279 + &mut cost,
280 + &base_path,
281 + estimated_layer_info
282 + .estimated_layer_count
283 + .estimated_to_be_empty(),
284 + estimated_layer_info.is_sum_tree,
285 + );
286 + estimated_layer_info.is_sum_tree
287 + });
|
Check warning on line 231 in grovedb/src/batch/estimated_costs/average_case_costs.rs
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 46 in grovedb/src/batch/mode.rs
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
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