summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
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 */