Fixing some clippy warnings (#1728)

* Fixing warnings

* Fixing unnecessary ref

* Removing unnecessary operation
This commit is contained in:
Tomasz Drwięga
2016-07-26 20:31:25 +02:00
committed by Gav Wood
parent 01e33ffb61
commit 3f41186b2e
36 changed files with 81 additions and 86 deletions

View File

@@ -522,7 +522,7 @@ impl Configuration {
self.args.flag_geth ||
self.args.flag_no_signer;
return !signer_disabled;
!signer_disabled
}
}

View File

@@ -184,6 +184,7 @@ pub fn default_network_config() -> ::util::NetworkConfiguration {
}
}
#[cfg_attr(feature = "dev", allow(too_many_arguments))]
pub fn to_client_config(
cache_config: &CacheConfig,
dirs: &Directories,
@@ -356,6 +357,7 @@ mod tests {
}
#[test]
#[cfg_attr(feature = "dev", allow(float_cmp))]
fn test_to_price() {
assert_eq!(to_price("1").unwrap(), 1.0);
assert_eq!(to_price("2.3").unwrap(), 2.3);

View File

@@ -108,12 +108,12 @@ impl Informant {
info!(target: "import", "{} {} {}",
match importing {
true => format!("Syncing {} {} {} {}+{} Qed",
true => format!("Syncing {} {} {} {}+{} Qed",
paint(White.bold(), format!("{:>8}", format!("#{}", chain_info.best_block_number))),
paint(White.bold(), format!("{}", chain_info.best_block_hash)),
{
let last_report = match write_report.deref() { &Some(ref last_report) => last_report.clone(), _ => ClientReport::default() };
format!("{} blk/s {} tx/s {} Mgas/s",
format!("{} blk/s {} tx/s {} Mgas/s",
paint(Yellow.bold(), format!("{:4}", ((report.blocks_imported - last_report.blocks_imported) * 1000) as u64 / elapsed.as_milliseconds())),
paint(Yellow.bold(), format!("{:4}", ((report.transactions_applied - last_report.transactions_applied) * 1000) as u64 / elapsed.as_milliseconds())),
paint(Yellow.bold(), format!("{:3}", ((report.gas_processed - last_report.gas_processed) / From::from(elapsed.as_milliseconds() * 1000)).low_u64()))
@@ -160,7 +160,7 @@ impl ChainNotify for Informant {
let importing = queue_info.unverified_queue_size + queue_info.verified_queue_size > 3
|| self.sync.as_ref().map_or(false, |s| s.status().is_major_syncing());
if Instant::now() > *last_import + Duration::from_secs(1) && !importing {
if let Some(block) = imported.last().and_then(|h| self.client.block(BlockID::Hash(h.clone()))) {
if let Some(block) = imported.last().and_then(|h| self.client.block(BlockID::Hash(*h))) {
let view = BlockView::new(&block);
let header = view.header();
let tx_count = view.transactions_count();

View File

@@ -113,7 +113,7 @@ fn start() -> Result<String, String> {
fn main() {
// just redirect to the sync::main()
if std::env::args().nth(1).map(|arg| arg == "sync").unwrap_or(false) {
if std::env::args().nth(1).map_or(false, |arg| arg == "sync") {
sync::main();
return;
}