chore: clippy fixes (#1558)

This commit is contained in:
Tom French
2023-02-25 15:10:44 +00:00
committed by GitHub
parent 41748e818f
commit 036e935819
3 changed files with 5 additions and 7 deletions

View File

@@ -183,7 +183,7 @@ impl RpcServerArgs {
config = config
.with_http_address(socket_address)
.with_http(ServerBuilder::new())
.with_cors(self.http_corsdomain.clone().unwrap_or("".to_string()));
.with_cors(self.http_corsdomain.clone().unwrap_or_default());
}
if self.ws {

View File

@@ -190,7 +190,7 @@ fn ui<B: Backend, T: Table>(f: &mut Frame<'_, B>, app: &mut DbListTUI<T>) {
serde_json::to_string_pretty(
&app.entries.values().collect::<Vec<_>>()[app.state.selected().unwrap_or(0)],
)
.unwrap_or(String::from("Error serializing value!")),
.unwrap_or_else(|_| String::from("Error serializing value!")),
)
.block(Block::default().borders(Borders::ALL).title("Value (JSON)"))
.wrap(Wrap { trim: false })

View File

@@ -49,11 +49,9 @@ where
let block_hash = self
.client()
.block_hash_for_id(block_id)?
.ok_or_else(|| EthApiError::UnknownBlockNumber)?;
let total_difficulty = self
.client()
.header_td(&block_hash)?
.ok_or_else(|| EthApiError::UnknownBlockNumber)?;
.ok_or(EthApiError::UnknownBlockNumber)?;
let total_difficulty =
self.client().header_td(&block_hash)?.ok_or(EthApiError::UnknownBlockNumber)?;
let block = Block::from_block(block, total_difficulty, full.into(), Some(block_hash))?;
Ok(Some(block.into()))
} else {