From d587e6f79d9661dca0cefff432b74a75ba669d23 Mon Sep 17 00:00:00 2001 From: Artem Vorotnikov Date: Sat, 14 Dec 2024 16:35:37 +0300 Subject: [PATCH] Clippy fixes --- src/codec.rs | 8 ++++---- src/cursor.rs | 14 +++++++------- src/orm/cursor.rs | 16 ++++++++-------- src/orm/transaction.rs | 4 ++-- src/transaction.rs | 10 +++++----- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/codec.rs b/src/codec.rs index 5bdcf24..a1a0f6a 100644 --- a/src/codec.rs +++ b/src/codec.rs @@ -60,7 +60,7 @@ impl<'tx> Decodable<'tx> for lifetimed_bytes::Bytes<'tx> { } } -impl<'tx> Decodable<'tx> for Vec { +impl Decodable<'_> for Vec { fn decode(data_val: &[u8]) -> Result where Self: Sized, @@ -69,7 +69,7 @@ impl<'tx> Decodable<'tx> for Vec { } } -impl<'tx> Decodable<'tx> for () { +impl Decodable<'_> for () { fn decode(_: &[u8]) -> Result { Ok(()) } @@ -86,7 +86,7 @@ impl<'tx> Decodable<'tx> for () { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Deref, DerefMut)] pub struct ObjectLength(pub usize); -impl<'tx> Decodable<'tx> for ObjectLength { +impl Decodable<'_> for ObjectLength { fn decode(data_val: &[u8]) -> Result where Self: Sized, @@ -95,7 +95,7 @@ impl<'tx> Decodable<'tx> for ObjectLength { } } -impl<'tx, const LEN: usize> Decodable<'tx> for [u8; LEN] { +impl Decodable<'_> for [u8; LEN] { fn decode(data_val: &[u8]) -> Result where Self: Sized, diff --git a/src/cursor.rs b/src/cursor.rs index bfa831b..cdffc1c 100644 --- a/src/cursor.rs +++ b/src/cursor.rs @@ -484,7 +484,7 @@ where } } -impl<'txn> Cursor<'txn, RW> { +impl Cursor<'_, RW> { /// Puts a key/data pair into the table. The cursor will be positioned at /// the new data item, or on failure usually near it. pub fn put(&mut self, key: &[u8], data: &[u8], flags: WriteFlags) -> Result<()> { @@ -522,7 +522,7 @@ impl<'txn> Cursor<'txn, RW> { } } -impl<'txn, K> Clone for Cursor<'txn, K> +impl Clone for Cursor<'_, K> where K: TransactionKind, { @@ -531,7 +531,7 @@ where } } -impl<'txn, K> fmt::Debug for Cursor<'txn, K> +impl fmt::Debug for Cursor<'_, K> where K: TransactionKind, { @@ -540,7 +540,7 @@ where } } -impl<'txn, K> Drop for Cursor<'txn, K> +impl Drop for Cursor<'_, K> where K: TransactionKind, { @@ -732,7 +732,7 @@ where } } -impl<'txn, 'cur, K, Key, Value> Iterator for Iter<'txn, 'cur, K, Key, Value> +impl<'txn, K, Key, Value> Iterator for Iter<'txn, '_, K, Key, Value> where K: TransactionKind, Key: Decodable<'txn>, @@ -832,7 +832,7 @@ where } } -impl<'txn, 'cur, K, Key, Value> fmt::Debug for IterDup<'txn, 'cur, K, Key, Value> +impl<'txn, K, Key, Value> fmt::Debug for IterDup<'txn, '_, K, Key, Value> where K: TransactionKind, Key: Decodable<'txn>, @@ -843,7 +843,7 @@ where } } -impl<'txn, 'cur, K, Key, Value> Iterator for IterDup<'txn, 'cur, K, Key, Value> +impl<'txn, K, Key, Value> Iterator for IterDup<'txn, '_, K, Key, Value> where K: TransactionKind, Key: Decodable<'txn>, diff --git a/src/orm/cursor.rs b/src/orm/cursor.rs index 8f9d843..6d11a88 100644 --- a/src/orm/cursor.rs +++ b/src/orm/cursor.rs @@ -5,7 +5,7 @@ use std::marker::PhantomData; #[derive(Clone, Debug)] pub(crate) struct DecodableWrapper(pub T); -impl<'tx, T> crate::Decodable<'tx> for DecodableWrapper +impl crate::Decodable<'_> for DecodableWrapper where T: Decodable, { @@ -44,7 +44,7 @@ where Ok(None) } -impl<'tx, K, T> Cursor<'tx, K, T> +impl Cursor<'_, K, T> where K: TransactionKind, T: Table, @@ -117,7 +117,7 @@ where first: bool, } - impl<'tx, K, T> Iterator for I<'tx, K, T> + impl Iterator for I<'_, K, T> where K: TransactionKind, T: Table, @@ -164,7 +164,7 @@ where first: bool, } - impl<'tx, K, T> Iterator for I<'tx, K, T> + impl Iterator for I<'_, K, T> where K: TransactionKind, T: Table, @@ -194,7 +194,7 @@ where } } -impl<'tx, K, T> Cursor<'tx, K, T> +impl Cursor<'_, K, T> where K: TransactionKind, T: DupSort, @@ -277,7 +277,7 @@ where first: bool, } - impl<'tx, K, T> Iterator for I<'tx, K, T> + impl Iterator for I<'_, K, T> where K: TransactionKind, T: DupSort, @@ -309,7 +309,7 @@ where } } -impl<'tx, T> Cursor<'tx, RW, T> +impl Cursor<'_, RW, T> where T: Table, { @@ -336,7 +336,7 @@ where } } -impl<'tx, T> Cursor<'tx, RW, T> +impl Cursor<'_, RW, T> where T: DupSort, { diff --git a/src/orm/transaction.rs b/src/orm/transaction.rs index 24531ff..3889a63 100644 --- a/src/orm/transaction.rs +++ b/src/orm/transaction.rs @@ -11,7 +11,7 @@ where pub(crate) inner: crate::Transaction<'db, K, WriteMap>, } -impl<'db> Transaction<'db, RO> { +impl Transaction<'_, RO> { pub fn table_sizes(&self) -> anyhow::Result> { let mut out = HashMap::new(); let main_table = self.inner.open_table(None)?; @@ -75,7 +75,7 @@ where } } -impl<'db> Transaction<'db, RW> { +impl Transaction<'_, RW> { pub fn upsert(&self, key: T::Key, value: T::Value) -> anyhow::Result<()> where T: Table, diff --git a/src/transaction.rs b/src/transaction.rs index 633f02c..b6115e8 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -231,7 +231,7 @@ pub(crate) fn txn_execute T, T>(txn: &Mutex Transaction<'db, RW, E> +impl Transaction<'_, RW, E> where E: DatabaseKind, { @@ -397,7 +397,7 @@ where } } -impl<'db, E> Transaction<'db, RO, E> +impl Transaction<'_, RO, E> where E: DatabaseKind, { @@ -412,7 +412,7 @@ where } } -impl<'db> Transaction<'db, RW, NoWriteMap> { +impl Transaction<'_, RW, NoWriteMap> { /// Begins a new nested transaction inside of this transaction. pub fn begin_nested_txn(&mut self) -> Result> { txn_execute(&self.txn, |txn| { @@ -435,7 +435,7 @@ impl<'db> Transaction<'db, RW, NoWriteMap> { } } -impl<'db, K, E> fmt::Debug for Transaction<'db, K, E> +impl fmt::Debug for Transaction<'_, K, E> where K: TransactionKind, E: DatabaseKind, @@ -445,7 +445,7 @@ where } } -impl<'db, K, E> Drop for Transaction<'db, K, E> +impl Drop for Transaction<'_, K, E> where K: TransactionKind, E: DatabaseKind,