Skip to content

Commit

Permalink
Clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vorot93 committed Dec 14, 2024
1 parent c9d606c commit d587e6f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<'tx> Decodable<'tx> for lifetimed_bytes::Bytes<'tx> {
}
}

impl<'tx> Decodable<'tx> for Vec<u8> {
impl Decodable<'_> for Vec<u8> {
fn decode(data_val: &[u8]) -> Result<Self, Error>
where
Self: Sized,
Expand All @@ -69,7 +69,7 @@ impl<'tx> Decodable<'tx> for Vec<u8> {
}
}

impl<'tx> Decodable<'tx> for () {
impl Decodable<'_> for () {
fn decode(_: &[u8]) -> Result<Self, Error> {
Ok(())
}
Expand All @@ -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<Self, Error>
where
Self: Sized,
Expand All @@ -95,7 +95,7 @@ impl<'tx> Decodable<'tx> for ObjectLength {
}
}

impl<'tx, const LEN: usize> Decodable<'tx> for [u8; LEN] {
impl<const LEN: usize> Decodable<'_> for [u8; LEN] {
fn decode(data_val: &[u8]) -> Result<Self, Error>
where
Self: Sized,
Expand Down
14 changes: 7 additions & 7 deletions src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<()> {
Expand Down Expand Up @@ -522,7 +522,7 @@ impl<'txn> Cursor<'txn, RW> {
}
}

impl<'txn, K> Clone for Cursor<'txn, K>
impl<K> Clone for Cursor<'_, K>
where
K: TransactionKind,
{
Expand All @@ -531,7 +531,7 @@ where
}
}

impl<'txn, K> fmt::Debug for Cursor<'txn, K>
impl<K> fmt::Debug for Cursor<'_, K>
where
K: TransactionKind,
{
Expand All @@ -540,7 +540,7 @@ where
}
}

impl<'txn, K> Drop for Cursor<'txn, K>
impl<K> Drop for Cursor<'_, K>
where
K: TransactionKind,
{
Expand Down Expand Up @@ -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>,
Expand Down Expand Up @@ -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>,
Expand All @@ -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>,
Expand Down
16 changes: 8 additions & 8 deletions src/orm/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::marker::PhantomData;
#[derive(Clone, Debug)]
pub(crate) struct DecodableWrapper<T>(pub T);

impl<'tx, T> crate::Decodable<'tx> for DecodableWrapper<T>
impl<T> crate::Decodable<'_> for DecodableWrapper<T>
where
T: Decodable,
{
Expand Down Expand Up @@ -44,7 +44,7 @@ where
Ok(None)
}

impl<'tx, K, T> Cursor<'tx, K, T>
impl<K, T> Cursor<'_, K, T>
where
K: TransactionKind,
T: Table,
Expand Down Expand Up @@ -117,7 +117,7 @@ where
first: bool,
}

impl<'tx, K, T> Iterator for I<'tx, K, T>
impl<K, T> Iterator for I<'_, K, T>
where
K: TransactionKind,
T: Table<Key: Decodable>,
Expand Down Expand Up @@ -164,7 +164,7 @@ where
first: bool,
}

impl<'tx, K, T> Iterator for I<'tx, K, T>
impl<K, T> Iterator for I<'_, K, T>
where
K: TransactionKind,
T: Table<Key: Decodable>,
Expand Down Expand Up @@ -194,7 +194,7 @@ where
}
}

impl<'tx, K, T> Cursor<'tx, K, T>
impl<K, T> Cursor<'_, K, T>
where
K: TransactionKind,
T: DupSort,
Expand Down Expand Up @@ -277,7 +277,7 @@ where
first: bool,
}

impl<'tx, K, T> Iterator for I<'tx, K, T>
impl<K, T> Iterator for I<'_, K, T>
where
K: TransactionKind,
T: DupSort<Key: Clone + Decodable>,
Expand Down Expand Up @@ -309,7 +309,7 @@ where
}
}

impl<'tx, T> Cursor<'tx, RW, T>
impl<T> Cursor<'_, RW, T>
where
T: Table,
{
Expand All @@ -336,7 +336,7 @@ where
}
}

impl<'tx, T> Cursor<'tx, RW, T>
impl<T> Cursor<'_, RW, T>
where
T: DupSort,
{
Expand Down
4 changes: 2 additions & 2 deletions src/orm/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<HashMap<String, u64>> {
let mut out = HashMap::new();
let main_table = self.inner.open_table(None)?;
Expand Down Expand Up @@ -75,7 +75,7 @@ where
}
}

impl<'db> Transaction<'db, RW> {
impl Transaction<'_, RW> {
pub fn upsert<T>(&self, key: T::Key, value: T::Value) -> anyhow::Result<()>
where
T: Table,
Expand Down
10 changes: 5 additions & 5 deletions src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ pub(crate) fn txn_execute<F: FnOnce(*mut ffi::MDBX_txn) -> T, T>(txn: &Mutex<Txn
(f)(lck.0)
}

impl<'db, E> Transaction<'db, RW, E>
impl<E> Transaction<'_, RW, E>
where
E: DatabaseKind,
{
Expand Down Expand Up @@ -397,7 +397,7 @@ where
}
}

impl<'db, E> Transaction<'db, RO, E>
impl<E> Transaction<'_, RO, E>
where
E: DatabaseKind,
{
Expand All @@ -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<Transaction<'_, RW, NoWriteMap>> {
txn_execute(&self.txn, |txn| {
Expand All @@ -435,7 +435,7 @@ impl<'db> Transaction<'db, RW, NoWriteMap> {
}
}

impl<'db, K, E> fmt::Debug for Transaction<'db, K, E>
impl<K, E> fmt::Debug for Transaction<'_, K, E>
where
K: TransactionKind,
E: DatabaseKind,
Expand All @@ -445,7 +445,7 @@ where
}
}

impl<'db, K, E> Drop for Transaction<'db, K, E>
impl<K, E> Drop for Transaction<'_, K, E>
where
K: TransactionKind,
E: DatabaseKind,
Expand Down

0 comments on commit d587e6f

Please sign in to comment.