Skip to content

Commit

Permalink
chore: remove useless trait bounds from struct definition (#1429)
Browse files Browse the repository at this point in the history
  • Loading branch information
koushiro authored May 15, 2024
1 parent 17eeb7a commit 6250ae7
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 13 deletions.
5 changes: 3 additions & 2 deletions client/cli/src/frontier_db_cmd/mapping_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ pub enum MappingKey {
EthBlockOrTransactionHash(H256),
}

pub struct MappingDb<'a, B: BlockT, C> {
pub struct MappingDb<'a, B, C> {
cmd: &'a FrontierDbCmd,
client: Arc<C>,
backend: Arc<fc_db::kv::Backend<B, C>>,
}

impl<'a, B: BlockT, C> MappingDb<'a, B, C>
impl<'a, B, C> MappingDb<'a, B, C>
where
B: BlockT,
C: HeaderBackend<B> + ProvideRuntimeApi<B>,
C::Api: EthereumRuntimeRPCApi<B>,
{
Expand Down
2 changes: 1 addition & 1 deletion client/cli/src/frontier_db_cmd/meta_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl FromStr for MetaKey {
}
}

pub struct MetaDb<'a, B: BlockT, C> {
pub struct MetaDb<'a, B, C> {
cmd: &'a FrontierDbCmd,
backend: Arc<fc_db::kv::Backend<B, C>>,
}
Expand Down
3 changes: 2 additions & 1 deletion client/cli/src/frontier_db_cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ pub enum DbValue<H> {
}

impl FrontierDbCmd {
pub fn run<B: BlockT, C>(
pub fn run<B, C>(
&self,
client: Arc<C>,
backend: Arc<fc_db::kv::Backend<B, C>>,
) -> sc_cli::Result<()>
where
B: BlockT,
C: HeaderBackend<B> + ProvideRuntimeApi<B>,
C::Api: fp_rpc::EthereumRuntimeRPCApi<B>,
{
Expand Down
6 changes: 3 additions & 3 deletions client/db/src/kv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub mod static_keys {
}

#[derive(Clone)]
pub struct Backend<Block: BlockT, C> {
pub struct Backend<Block, C> {
client: Arc<C>,
meta: Arc<MetaDb<Block>>,
mapping: Arc<MappingDb<Block>>,
Expand Down Expand Up @@ -180,7 +180,7 @@ impl<Block: BlockT, C: HeaderBackend<Block>> Backend<Block, C> {
}
}

pub struct MetaDb<Block: BlockT> {
pub struct MetaDb<Block> {
db: Arc<dyn Database<DbHash>>,
_marker: PhantomData<Block>,
}
Expand Down Expand Up @@ -247,7 +247,7 @@ pub struct MappingCommitment<Block: BlockT> {
pub ethereum_transaction_hashes: Vec<H256>,
}

pub struct MappingDb<Block: BlockT> {
pub struct MappingDb<Block> {
db: Arc<dyn Database<DbHash>>,
write_lock: Arc<Mutex<()>>,
_marker: PhantomData<Block>,
Expand Down
3 changes: 1 addition & 2 deletions client/db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ use std::sync::Arc;

// Substrate
pub use sc_client_db::DatabaseSource;
use sp_runtime::traits::Block as BlockT;

pub mod kv;
#[cfg(feature = "sql")]
pub mod sql;

#[derive(Clone)]
pub enum Backend<Block: BlockT, C> {
pub enum Backend<Block, C> {
KeyValue(Arc<kv::Backend<Block, C>>),
#[cfg(feature = "sql")]
Sql(Arc<sql::Backend<Block>>),
Expand Down
4 changes: 2 additions & 2 deletions client/db/src/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub enum BackendConfig<'a> {
}

#[derive(Clone)]
pub struct Backend<Block: BlockT> {
pub struct Backend<Block> {
/// The Sqlite connection.
pool: SqlitePool,
/// The additional overrides for the logs handler.
Expand All @@ -104,7 +104,7 @@ pub struct Backend<Block: BlockT> {
num_ops_timeout: i32,
}

impl<Block: BlockT> Backend<Block>
impl<Block> Backend<Block>
where
Block: BlockT<Hash = H256>,
{
Expand Down
3 changes: 2 additions & 1 deletion client/mapping-sync/src/kv/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ impl<Block: BlockT, C, BE> MappingSyncWorker<Block, C, BE> {
}
}

impl<Block: BlockT, C, BE> Stream for MappingSyncWorker<Block, C, BE>
impl<Block, C, BE> Stream for MappingSyncWorker<Block, C, BE>
where
Block: BlockT,
C: ProvideRuntimeApi<Block>,
C::Api: EthereumRuntimeRPCApi<Block>,
C: HeaderBackend<Block> + StorageProvider<Block, BE>,
Expand Down
2 changes: 1 addition & 1 deletion client/mapping-sync/src/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub struct SyncWorker<Block, Backend, Client> {
_phantom: std::marker::PhantomData<(Block, Backend, Client)>,
}

impl<Block: BlockT, Backend, Client> SyncWorker<Block, Backend, Client>
impl<Block, Backend, Client> SyncWorker<Block, Backend, Client>
where
Block: BlockT<Hash = H256>,
Client: ProvideRuntimeApi<Block>,
Expand Down

0 comments on commit 6250ae7

Please sign in to comment.