better trunk panic #311
better trunk panic #311
clippy
41 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 41 |
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 957 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:957:10
|
957 | ) -> 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 887 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:887:10
|
887 | ) -> 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 861 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:861:10
|
861 | ) -> 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 171 in grovedb/src/reference_path.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> grovedb/src/reference_path.rs:171:76
|
171 | if usize::from(no_of_elements_to_keep) > current_path.len() || current_path.len() == 0 {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `current_path.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
= note: `#[warn(clippy::len_zero)]` on by default
Check warning on line 262 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:262:41
|
262 | 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
Check warning on line 260 in grovedb/src/query_result_type.rs
github-actions / clippy
redundant pattern matching, consider using `is_some()`
warning: redundant pattern matching, consider using `is_some()`
--> grovedb/src/query_result_type.rs:260:24
|
260 | if let Some(_) = path.pop() {
| -------^^^^^^^------------- help: try: `if path.pop().is_some()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
= note: `#[warn(clippy::redundant_pattern_matching)]` on by default
Check warning on line 241 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:241:37
|
241 | 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 222 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:222:26
|
222 | .or_insert_with(BTreeMap::new)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 204 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:204:37
|
204 | 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 586 in grovedb/src/operations/proof/verify.rs
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:586:17
|
586 | *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
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
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
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 363 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:361:9
|
361 | / let Some(value_cost) = self.get_specialized_cost().ok() else {
362 | | return None;
363 | | };
| |__________^ 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 290 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:290:14
|
290 | 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 12 in grovedb/src/versioning.rs
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
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
Check warning on line 44 in grovedb/src/operations/proof/util.rs
github-actions / clippy
unused import: `reference_path::ReferencePathType`
warning: unused import: `reference_path::ReferencePathType`
--> grovedb/src/operations/proof/util.rs:44:57
|
44 | use crate::{operations::proof::verify::ProvedKeyValues, reference_path::ReferencePathType};
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Check warning on line 3 in grovedb/src/debugger.rs
github-actions / clippy
unused import: `net::Ipv4Addr`
warning: unused import: `net::Ipv4Addr`
--> grovedb/src/debugger.rs:3:15
|
3 | use std::{fs, net::Ipv4Addr, sync::Weak};
| ^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
Check warning on line 77 in merk/src/estimated_costs/average_case_costs.rs
github-actions / clippy
duplicated attribute
warning: duplicated attribute
--> merk/src/estimated_costs/average_case_costs.rs:77:7
|
77 | #[cfg(feature = "full")]
| ^^^^^^^^^^^^^^^^
|
note: first defined here
--> merk/src/estimated_costs/average_case_costs.rs:76:7
|
76 | #[cfg(feature = "full")]
| ^^^^^^^^^^^^^^^^
help: remove this attribute
--> merk/src/estimated_costs/average_case_costs.rs:77:7
|
77 | #[cfg(feature = "full")]
| ^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes
= note: `#[warn(clippy::duplicated_attributes)]` on by default