From 41a90efaa263bff44c547dd463e754de45a984f3 Mon Sep 17 00:00:00 2001 From: koushiro Date: Wed, 14 Jun 2023 19:15:01 +0800 Subject: [PATCH] make clippy happy --- client/db/src/sql/mod.rs | 29 +++++++++++------------------ template/node/src/eth.rs | 9 ++------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/client/db/src/sql/mod.rs b/client/db/src/sql/mod.rs index c81df93fcf..204b8a1af2 100644 --- a/client/db/src/sql/mod.rs +++ b/client/db/src/sql/mod.rs @@ -303,8 +303,8 @@ where } None => { return Err(Error::Protocol(format!( - "Missing ethereum block for hash mismatch {expect_eth_block_hash:?}" - ))) + "Missing ethereum block for hash mismatch {expect_eth_block_hash:?}" + ))) } } } @@ -341,24 +341,17 @@ where is_canon, }) } - Err(FindLogError::NotFound) => { - return Err(Error::Protocol(format!( - "[Metadata] No logs found for hash {:?}", - hash - ))) - } - Err(FindLogError::MultipleLogs) => { - return Err(Error::Protocol(format!( - "[Metadata] Multiple logs found for hash {:?}", - hash - ))) - } + Err(FindLogError::NotFound) => Err(Error::Protocol(format!( + "[Metadata] No logs found for hash {hash:?}", + ))), + Err(FindLogError::MultipleLogs) => Err(Error::Protocol(format!( + "[Metadata] Multiple logs found for hash {hash:?}", + ))), } } else { - return Err(Error::Protocol(format!( - "[Metadata] Failed retrieving header for hash {:?}", - hash - ))); + Err(Error::Protocol(format!( + "[Metadata] Failed retrieving header for hash {hash:?}" + ))) } } diff --git a/template/node/src/eth.rs b/template/node/src/eth.rs index 8f28a4b637..f402df7368 100644 --- a/template/node/src/eth.rs +++ b/template/node/src/eth.rs @@ -37,20 +37,15 @@ pub fn db_config_dir(config: &Configuration) -> PathBuf { } /// Avalailable frontier backend types. -#[derive(Debug, Copy, Clone, clap::ValueEnum)] +#[derive(Debug, Copy, Clone, Default, clap::ValueEnum)] pub enum BackendType { /// Either RocksDb or ParityDb as per inherited from the global backend settings. + #[default] KeyValue, /// Sql database with custom log indexing. Sql, } -impl Default for BackendType { - fn default() -> BackendType { - BackendType::KeyValue - } -} - /// The ethereum-compatibility configuration used to run a node. #[derive(Clone, Debug, clap::Parser)] pub struct EthConfiguration {