chore: clean relative to references and borrows

- lint message: the borrowed expression implements the required traits
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_borrows_for_generic_args
- lint message: this expression creates a reference which is immediately dereferenced by the compiler
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_borrow
- lint message: you don't need to add `&` to all patterns
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#match_ref_pat
- remove useless taken reference
lint message: needlessly taken reference of left operand
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#op_ref
- use &Path instead of &PathBuf as fn parameters
lint message: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#ptr_arg
This commit is contained in:
Gwen Lg
2025-12-13 17:43:05 +01:00
parent 209263eb93
commit 141b3f24f1
35 changed files with 129 additions and 134 deletions
+6 -6
View File
@@ -1,6 +1,6 @@
use core::ops::Bound;
use std::path::PathBuf;
use std::path::Path;
use std::sync::Arc;
use parking_lot::{MappedRwLockReadGuard, RwLock, RwLockReadGuard};
@@ -20,7 +20,7 @@ pub use fjall;
// --
pub(crate) fn open_db(path: &PathBuf, opt: &OpenOpt) -> Result<Db> {
pub(crate) fn open_db(path: &Path, opt: &OpenOpt) -> Result<Db> {
info!("Opening Fjall database at: {}", path.display());
if opt.fsync {
return Err(Error(
@@ -109,11 +109,11 @@ impl IDb for FjallDb {
.keyspace
.list_partitions()
.iter()
.map(|n| decode_name(&n))
.map(|n| decode_name(n))
.collect::<Result<Vec<_>>>()?)
}
fn snapshot(&self, base_path: &PathBuf) -> Result<()> {
fn snapshot(&self, base_path: &Path) -> Result<()> {
std::fs::create_dir_all(base_path)?;
let path = Engine::Fjall.db_path(base_path);
@@ -325,7 +325,7 @@ impl<'a> ITx for FjallTx<'a> {
let high = clone_bound(high);
Ok(Box::new(
self.tx
.range::<Vec<u8>, ByteVecRangeBounds>(&tree, (low, high))
.range::<Vec<u8>, ByteVecRangeBounds>(tree, (low, high))
.map(iterator_remap_tx),
))
}
@@ -340,7 +340,7 @@ impl<'a> ITx for FjallTx<'a> {
let high = clone_bound(high);
Ok(Box::new(
self.tx
.range::<Vec<u8>, ByteVecRangeBounds>(&tree, (low, high))
.range::<Vec<u8>, ByteVecRangeBounds>(tree, (low, high))
.rev()
.map(iterator_remap_tx),
))