diff options
author | Oxore <oxore@protonmail.com> | 2019-11-11 01:01:31 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2019-11-11 01:01:31 +0300 |
commit | b5be6c86d3764131d328389ceeedeb2af46039cc (patch) | |
tree | 1c1ff6ae839a3c06d0e3a1dafcb5ed287abf1a43 /src/main.rs | |
parent | fdd1c7d66bc5fa0712422af9a069e2a84de8c1a4 (diff) |
Fix Clippy's complains
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index d588823..358ac4e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,6 @@ use std::env; use std::fs; use std::io; use std::io::prelude::*; -use std::string::String; use std::sync::{Arc, Condvar, Mutex}; use std::thread::sleep; use std::{thread, time}; @@ -13,13 +12,13 @@ use self::core::Core; fn core_worker(mut core: Core, should_stop: &Mutex<bool>, cvar: &Condvar) { loop { - while false == *should_stop.lock().unwrap() { + while !(*should_stop.lock().unwrap()) { core.step(); println!("{}", core.op()); sleep(time::Duration::from_millis(1000)); } - while true == *should_stop.lock().unwrap() { + while *should_stop.lock().unwrap() { let _ = cvar.wait(should_stop.lock().unwrap()).unwrap(); } } @@ -51,12 +50,12 @@ fn main() { println!("Please, specify ihex file"); return; } - let data = fs::read_to_string(&args[1]).expect(&format!("Unable to read file {}", &args[1])); + let data = fs::read_to_string(&args[1]).unwrap_or_else(|_| panic!("Unable to read file {}", &args[1])); let asyncpair = Arc::new((Mutex::new(false), Condvar::new())); let asyncpair2 = asyncpair.clone(); - let core = match Core::new_with_ram_from_hex(String::from(data)) { + let core = match Core::new_with_ram_from_hex(data) { Ok(value) => value, Err(err_string) => { println!("{}", err_string); |