Skip to content

Commit fd5ad4a

Browse files
committed
Make clippy happy
1 parent 8a4da90 commit fd5ad4a

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

heed-types/src/integer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct U8;
1111
impl BytesEncode<'_> for U8 {
1212
type EItem = u8;
1313

14-
fn bytes_encode(item: &Self::EItem) -> Result<Cow<[u8]>, BoxedError> {
14+
fn bytes_encode(item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
1515
Ok(Cow::from([*item].to_vec()))
1616
}
1717
}
@@ -30,7 +30,7 @@ pub struct I8;
3030
impl BytesEncode<'_> for I8 {
3131
type EItem = i8;
3232

33-
fn bytes_encode(item: &Self::EItem) -> Result<Cow<[u8]>, BoxedError> {
33+
fn bytes_encode(item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
3434
Ok(Cow::from([*item as u8].to_vec()))
3535
}
3636
}
@@ -54,7 +54,7 @@ macro_rules! define_type {
5454
impl<O: ByteOrder> BytesEncode<'_> for $name<O> {
5555
type EItem = $native;
5656

57-
fn bytes_encode(item: &Self::EItem) -> Result<Cow<[u8]>, BoxedError> {
57+
fn bytes_encode(item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
5858
let mut buf = vec![0; size_of::<Self::EItem>()];
5959
O::$write_method(&mut buf, *item);
6060
Ok(Cow::from(buf))

heed-types/src/serde_json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ where
1414
{
1515
type EItem = T;
1616

17-
fn bytes_encode(item: &Self::EItem) -> Result<Cow<[u8]>, BoxedError> {
17+
fn bytes_encode(item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
1818
serde_json::to_vec(item).map(Cow::Owned).map_err(Into::into)
1919
}
2020
}

heed-types/src/serde_rmp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ where
1414
{
1515
type EItem = T;
1616

17-
fn bytes_encode(item: &Self::EItem) -> Result<Cow<[u8]>, BoxedError> {
17+
fn bytes_encode(item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
1818
rmp_serde::to_vec(item).map(Cow::Owned).map_err(Into::into)
1919
}
2020
}

heed-types/src/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub enum Str {}
99
impl BytesEncode<'_> for Str {
1010
type EItem = str;
1111

12-
fn bytes_encode(item: &Self::EItem) -> Result<Cow<[u8]>, BoxedError> {
12+
fn bytes_encode(item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
1313
Ok(Cow::Borrowed(item.as_bytes()))
1414
}
1515
}

heed-types/src/unit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub enum Unit {}
99
impl BytesEncode<'_> for Unit {
1010
type EItem = ();
1111

12-
fn bytes_encode(_item: &Self::EItem) -> Result<Cow<[u8]>, BoxedError> {
12+
fn bytes_encode(_item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
1313
Ok(Cow::Borrowed(&[]))
1414
}
1515
}

heed/src/envs/encrypted_env.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ impl<T> EncryptedEnv<T> {
103103
}
104104

105105
/// Options and flags which can be used to configure how a [`Database`] is opened.
106-
pub fn database_options(&self) -> EncryptedDatabaseOpenOptions<T, Unspecified, Unspecified> {
106+
pub fn database_options(
107+
&self,
108+
) -> EncryptedDatabaseOpenOptions<'_, '_, T, Unspecified, Unspecified> {
107109
EncryptedDatabaseOpenOptions::new(self)
108110
}
109111

@@ -174,7 +176,7 @@ impl<T> EncryptedEnv<T> {
174176
/// If another write transaction is initiated, while another write transaction exists
175177
/// the thread initiating the new one will wait on a mutex upon completion of the previous
176178
/// transaction.
177-
pub fn write_txn(&self) -> Result<RwTxn> {
179+
pub fn write_txn(&self) -> Result<RwTxn<'_>> {
178180
self.inner.write_txn()
179181
}
180182

@@ -215,7 +217,7 @@ impl<T> EncryptedEnv<T> {
215217
/// map must be resized
216218
/// * [`crate::MdbError::ReadersFull`]: a read-only transaction was requested, and the reader lock table is
217219
/// full
218-
pub fn read_txn(&self) -> Result<RoTxn<T>> {
220+
pub fn read_txn(&self) -> Result<RoTxn<'_, T>> {
219221
self.inner.read_txn()
220222
}
221223

heed/src/envs/env.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<T> Env<T> {
195195
}
196196

197197
/// Options and flags which can be used to configure how a [`Database`] is opened.
198-
pub fn database_options(&self) -> DatabaseOpenOptions<T, Unspecified, Unspecified> {
198+
pub fn database_options(&self) -> DatabaseOpenOptions<'_, '_, T, Unspecified, Unspecified> {
199199
DatabaseOpenOptions::new(self)
200200
}
201201

@@ -331,7 +331,7 @@ impl<T> Env<T> {
331331
/// If another write transaction is initiated, while another write transaction exists
332332
/// the thread initiating the new one will wait on a mutex upon completion of the previous
333333
/// transaction.
334-
pub fn write_txn(&self) -> Result<RwTxn> {
334+
pub fn write_txn(&self) -> Result<RwTxn<'_>> {
335335
RwTxn::new(self)
336336
}
337337

@@ -372,7 +372,7 @@ impl<T> Env<T> {
372372
/// map must be resized
373373
/// * [`crate::MdbError::ReadersFull`]: a read-only transaction was requested, and the reader lock table is
374374
/// full
375-
pub fn read_txn(&self) -> Result<RoTxn<T>> {
375+
pub fn read_txn(&self) -> Result<RoTxn<'_, T>> {
376376
RoTxn::new(self)
377377
}
378378

@@ -594,7 +594,7 @@ impl<T> Env<T> {
594594
/// it is okay to call `mdb_env_set_mapsize` for an open environment as long as no transactions are active,
595595
/// but the library does not check for this condition, so the caller must ensure it explicitly.
596596
pub unsafe fn resize(&self, new_size: usize) -> Result<()> {
597-
if new_size % page_size::get() != 0 {
597+
if !new_size.is_multiple_of(page_size::get()) {
598598
let msg = format!(
599599
"map size ({}) must be a multiple of the system page size ({})",
600600
new_size,

heed/src/envs/env_open_options.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
use std::ffi::CString;
2-
#[cfg(windows)]
3-
use std::ffi::OsStr;
42
use std::io::ErrorKind::NotFound;
53
use std::marker::PhantomData;
64
#[cfg(unix)]

0 commit comments

Comments
 (0)