diff options
author | Oxore <oxore@protonmail.com> | 2020-02-24 20:38:35 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2020-02-24 20:38:35 +0300 |
commit | e3bf2663362b7362569679bbbd15287e73a8ad2a (patch) | |
tree | e0b98356fd9b6214280f34fa5162efbd621058ba | |
parent | f92e5bce166cc9f73e0fac40c5195745c763eba5 (diff) |
Fix clippy complains
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index 74aeed0..8f1acad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,7 +30,7 @@ struct BoundCore { fn new_bound_pair() -> (BoundCore, BoundController) { let (tx_c, rx_c): (Sender<Control>, Receiver<Control>) = channel(); let (tx_d, rx_d): (Sender<SimData>, Receiver<SimData>) = channel(); - return ( + ( BoundCore { _tx: tx_d, rx: rx_c, @@ -39,7 +39,7 @@ fn new_bound_pair() -> (BoundCore, BoundController) { tx: tx_c, _rx: rx_d, }, - ); + ) } fn cli_controller(bound: BoundController) { @@ -76,7 +76,7 @@ fn new_controller(name: &str) -> Result<&dyn Fn(BoundController), i32> { fn core_worker(mut core: Core, bound: BoundCore) { let mut should_stop = false; loop { - if should_stop == true { + if should_stop { if let Ok(msg) = bound.rx.recv() { match msg { Control::Run(run) => should_stop = !run, @@ -130,10 +130,8 @@ fn main() { let controller_type_name = cli_args_matches .value_of("interface") .expect("No interface type specified"); - new_controller(controller_type_name).expect(&format!( - "Unknown controller type \"{}\"", - controller_type_name - )) + new_controller(controller_type_name) + .unwrap_or_else(|_| panic!("Unknown controller type \"{}\"", controller_type_name)) }; /* Read program and instantiate a simulator */ |