Purging .derefs, fixing clippy warnings. (#1890)
* Fixing clippy warnings * Purging derefs * Simplifying engine derefs * Simplifying more engine derefs
This commit is contained in:
committed by
Arkadiy Paronyan
parent
8018b69440
commit
a427208f79
@@ -21,7 +21,6 @@ use self::ansi_term::Style;
|
||||
use std::sync::{Arc};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
|
||||
use std::time::{Instant, Duration};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use isatty::{stdout_isatty};
|
||||
use ethsync::{SyncProvider, ManageNetwork};
|
||||
use util::{Uint, RwLock, Mutex, H256, Colour};
|
||||
@@ -112,7 +111,7 @@ impl Informant {
|
||||
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() };
|
||||
let last_report = match *write_report { Some(ref last_report) => last_report.clone(), _ => ClientReport::default() };
|
||||
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())),
|
||||
@@ -147,9 +146,9 @@ impl Informant {
|
||||
)
|
||||
);
|
||||
|
||||
*self.chain_info.write().deref_mut() = Some(chain_info);
|
||||
*self.cache_info.write().deref_mut() = Some(cache_info);
|
||||
*write_report.deref_mut() = Some(report);
|
||||
*self.chain_info.write() = Some(chain_info);
|
||||
*self.cache_info.write() = Some(cache_info);
|
||||
*write_report = Some(report);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ impl SnapshotCommand {
|
||||
warn!("Snapshot restoration is experimental and the format may be subject to change.");
|
||||
|
||||
let snapshot = service.snapshot_service();
|
||||
let reader = PackedReader::new(&Path::new(&file))
|
||||
let reader = PackedReader::new(Path::new(&file))
|
||||
.map_err(|e| format!("Couldn't open snapshot file: {}", e))
|
||||
.and_then(|x| x.ok_or("Snapshot file has invalid format.".into()));
|
||||
|
||||
@@ -172,7 +172,7 @@ impl SnapshotCommand {
|
||||
pub fn take_snapshot(self) -> Result<(), String> {
|
||||
let file_path = try!(self.file_path.clone().ok_or("No file path provided.".to_owned()));
|
||||
let file_path: PathBuf = file_path.into();
|
||||
let block_at = self.block_at.clone();
|
||||
let block_at = self.block_at;
|
||||
let (service, _panic_handler) = try!(self.start_service());
|
||||
|
||||
warn!("Snapshots are currently experimental. File formats may be subject to change.");
|
||||
@@ -180,7 +180,7 @@ impl SnapshotCommand {
|
||||
let writer = try!(PackedWriter::new(&file_path)
|
||||
.map_err(|e| format!("Failed to open snapshot writer: {}", e)));
|
||||
|
||||
let progress = Arc::new(Progress::new());
|
||||
let progress = Arc::new(Progress::default());
|
||||
let p = progress.clone();
|
||||
let informant_handle = ::std::thread::spawn(move || {
|
||||
::std::thread::sleep(Duration::from_secs(5));
|
||||
@@ -221,4 +221,4 @@ pub fn execute(cmd: SnapshotCommand) -> Result<String, String> {
|
||||
}
|
||||
|
||||
Ok(String::new())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user