mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
clippy: add option_as_ref_cloned clippy lint (#10528)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -53,7 +53,7 @@ impl<K: TransactionKind, T: Table> Cursor<K, T> {
|
||||
value_size: Option<usize>,
|
||||
f: impl FnOnce(&mut Self) -> R,
|
||||
) -> R {
|
||||
if let Some(metrics) = self.metrics.as_ref().cloned() {
|
||||
if let Some(metrics) = self.metrics.clone() {
|
||||
metrics.record_operation(T::NAME, operation, value_size, || f(self))
|
||||
} else {
|
||||
f(self)
|
||||
|
||||
@ -147,7 +147,7 @@ impl Database for DatabaseEnv {
|
||||
fn tx(&self) -> Result<Self::TX, DatabaseError> {
|
||||
Tx::new_with_metrics(
|
||||
self.inner.begin_ro_txn().map_err(|e| DatabaseError::InitTx(e.into()))?,
|
||||
self.metrics.as_ref().cloned(),
|
||||
self.metrics.clone(),
|
||||
)
|
||||
.map_err(|e| DatabaseError::InitTx(e.into()))
|
||||
}
|
||||
@ -155,7 +155,7 @@ impl Database for DatabaseEnv {
|
||||
fn tx_mut(&self) -> Result<Self::TXMut, DatabaseError> {
|
||||
Tx::new_with_metrics(
|
||||
self.inner.begin_rw_txn().map_err(|e| DatabaseError::InitTx(e.into()))?,
|
||||
self.metrics.as_ref().cloned(),
|
||||
self.metrics.clone(),
|
||||
)
|
||||
.map_err(|e| DatabaseError::InitTx(e.into()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user