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
+5 -5
View File
@@ -3,7 +3,7 @@ use core::ops::Bound;
use std::collections::HashMap;
use std::convert::TryInto;
use std::marker::PhantomPinned;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::pin::Pin;
use std::sync::{Arc, RwLock};
@@ -22,7 +22,7 @@ pub use heed;
pub(crate) fn open_db(path: &PathBuf, opt: &OpenOpt) -> Result<Db> {
info!("Opening LMDB database at: {}", path.display());
if let Err(e) = std::fs::create_dir_all(&path) {
if let Err(e) = std::fs::create_dir_all(path) {
return Err(Error(
format!("Unable to create LMDB data directory: {}", e).into(),
));
@@ -44,7 +44,7 @@ pub(crate) fn open_db(path: &PathBuf, opt: &OpenOpt) -> Result<Db> {
env_builder.flag(heed::flags::Flags::MdbNoSync);
}
}
match env_builder.open(&path) {
match env_builder.open(path) {
Err(heed::Error::Io(e)) if e.kind() == std::io::ErrorKind::OutOfMemory => {
return Err(Error(
"OutOfMemory error while trying to open LMDB database. This can happen \
@@ -147,7 +147,7 @@ impl IDb for LmdbDb {
Ok(ret2)
}
fn snapshot(&self, base_path: &PathBuf) -> Result<()> {
fn snapshot(&self, base_path: &Path) -> Result<()> {
std::fs::create_dir_all(base_path)?;
let path = Engine::Lmdb.db_path(base_path);
self.db
@@ -399,7 +399,7 @@ where
// before the tx it is pointing to.
unsafe { &*&raw const *tx }
};
let iter = iterfun(&tx_lifetime_overextended)?;
let iter = iterfun(tx_lifetime_overextended)?;
*boxed.as_mut().iter() = Some(iter);