Skip to content

Commit

Permalink
fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
imabdulbasit committed Dec 4, 2024
1 parent 0be4e7c commit e8a1685
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/data_source/storage/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ pub trait Revert {
fn revert(&mut self);
}

impl<'a, Types> Revert for RwLockWriteGuard<'a, FileSystemStorageInner<Types>>
impl<Types> Revert for RwLockWriteGuard<'_, FileSystemStorageInner<Types>>
where
Types: NodeType,
Payload<Types>: QueryablePayload<Types>,
Expand All @@ -293,7 +293,7 @@ where
}
}

impl<'a, Types> Revert for RwLockReadGuard<'a, FileSystemStorageInner<Types>>
impl<Types> Revert for RwLockReadGuard<'_, FileSystemStorageInner<Types>>
where
Types: NodeType,
Payload<Types>: QueryablePayload<Types>,
Expand Down
12 changes: 3 additions & 9 deletions src/data_source/storage/ledger_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,7 @@ impl<T: Serialize + DeserializeOwned + Clone> LedgerLog<T> {
let len = store.iter().len();
tracing::info!("loading LedgerLog {}, len={}", file_pattern, len);

let cache_start = if len > cache_size {
len - cache_size
} else {
// If the cache is large enough to contain every object in storage, we start it at index
// 0 so that it does.
0
};
let cache_start = len.saturating_sub(cache_size);
let mut missing = 0;
let mut cache = store
.iter()
Expand Down Expand Up @@ -220,7 +214,7 @@ pub struct Iter<'a, T: Serialize + DeserializeOwned> {
store: append_log::Iter<'a, BincodeLoadStore<Option<T>>>,
}

impl<'a, T: Serialize + DeserializeOwned + Clone> Iterator for Iter<'a, T> {
impl<T: Serialize + DeserializeOwned + Clone> Iterator for Iter<'_, T> {
type Item = Option<T>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down Expand Up @@ -264,7 +258,7 @@ impl<'a, T: Serialize + DeserializeOwned + Clone> Iterator for Iter<'a, T> {
}
}

impl<'a, T: Serialize + DeserializeOwned + Clone> ExactSizeIterator for Iter<'a, T> {}
impl<T: Serialize + DeserializeOwned + Clone> ExactSizeIterator for Iter<'_, T> {}

#[cfg(test)]
mod test {
Expand Down
8 changes: 4 additions & 4 deletions src/data_source/storage/no_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl PrunerConfig for NoStorage {}
impl PruneStorage for NoStorage {
type Pruner = ();
}
impl<'a> PrunedHeightStorage for Transaction<'a> {}
impl PrunedHeightStorage for Transaction<'_> {}

impl HasMetrics for NoStorage {
fn metrics(&self) -> &PrometheusMetrics {
Expand All @@ -108,7 +108,7 @@ impl HasMetrics for NoStorage {
}

#[async_trait]
impl<'a, Types: NodeType> AvailabilityStorage<Types> for Transaction<'a>
impl<Types: NodeType> AvailabilityStorage<Types> for Transaction<'_>
where
Payload<Types>: QueryablePayload<Types>,
{
Expand Down Expand Up @@ -242,7 +242,7 @@ where
}

#[async_trait]
impl<'a, Types: NodeType> NodeStorage<Types> for Transaction<'a>
impl<Types: NodeType> NodeStorage<Types> for Transaction<'_>
where
Payload<Types>: QueryablePayload<Types>,
{
Expand Down Expand Up @@ -725,7 +725,7 @@ pub mod testing {
}

#[async_trait]
impl<'a, T> NodeStorage<MockTypes> for Transaction<'a, T>
impl<T> NodeStorage<MockTypes> for Transaction<'_, T>
where
T: NodeStorage<MockTypes> + Send,
{
Expand Down
6 changes: 3 additions & 3 deletions src/data_source/storage/sql/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub(super) struct Migrator<'a> {
}

#[async_trait]
impl<'a> AsyncTransaction for Migrator<'a> {
impl AsyncTransaction for Migrator<'_> {
type Error = sqlx::Error;

async fn execute(&mut self, queries: &[&str]) -> sqlx::Result<usize> {
Expand All @@ -38,7 +38,7 @@ impl<'a> AsyncTransaction for Migrator<'a> {
}

#[async_trait]
impl<'a> AsyncQuery<Vec<Migration>> for Migrator<'a> {
impl AsyncQuery<Vec<Migration>> for Migrator<'_> {
async fn query(&mut self, query: &str) -> sqlx::Result<Vec<Migration>> {
let mut tx = self.conn.begin().await?;

Expand Down Expand Up @@ -68,4 +68,4 @@ impl<'a> AsyncQuery<Vec<Migration>> for Migrator<'a> {
}
}

impl<'a> AsyncMigrate for Migrator<'a> {}
impl AsyncMigrate for Migrator<'_> {}
7 changes: 4 additions & 3 deletions src/data_source/storage/sql/queries.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::needless_lifetimes)]
// Copyright (c) 2022 Espresso Systems (espressosys.com)
// This file is part of the HotShot Query Service library.
//
Expand Down Expand Up @@ -81,9 +82,9 @@ pub(super) mod state;
/// ```
#[derive(Derivative, Default)]
#[derivative(Debug)]
pub struct QueryBuilder<'q> {
pub struct QueryBuilder<'a> {
#[derivative(Debug = "ignore")]
arguments: <Db as Database>::Arguments<'q>,
arguments: <Db as Database>::Arguments<'a>,
}

impl<'q> QueryBuilder<'q> {
Expand Down Expand Up @@ -112,7 +113,7 @@ impl<'q> QueryBuilder<'q> {
}
}

impl<'q> QueryBuilder<'q> {
impl QueryBuilder<'_> {
/// Construct a SQL `WHERE` clause which filters for a header exactly matching `id`.
pub fn header_where_clause<Types: NodeType>(
&mut self,
Expand Down
2 changes: 1 addition & 1 deletion src/explorer/monetary_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ where
}
}

impl<'de> serde::de::Visitor<'de> for MonetaryValueVisitor {
impl serde::de::Visitor<'_> for MonetaryValueVisitor {
type Value = MonetaryValue;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down

0 comments on commit e8a1685

Please sign in to comment.