clippy: add option_as_ref_cloned clippy lint (#10528)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Thomas Coratger
2024-08-26 01:33:05 -07:00
committed by GitHub
parent cac70d93e4
commit 986e402fe6
3 changed files with 4 additions and 3 deletions

View File

@ -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)

View File

@ -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()))
}