diff --git a/src/bin/accounting.rs b/src/bin/accounting.rs index 28b9837..94dbc2b 100644 --- a/src/bin/accounting.rs +++ b/src/bin/accounting.rs @@ -121,8 +121,7 @@ fn next_target(low_index: usize, high_index: usize, avoid: &[usize]) -> Option eprintln!("ERROR: {}", e), - Ok(_) => {} + if let Err(e) = real_main() { + eprintln!("ERROR: {}", e); } } diff --git a/src/bin/boarding_pass.rs b/src/bin/boarding_pass.rs index d6d9ee9..dcad4b3 100644 --- a/src/bin/boarding_pass.rs +++ b/src/bin/boarding_pass.rs @@ -150,8 +150,7 @@ fn real_main() -> Result<(), TopLevelError> { } fn main() { - match real_main() { - Err(e) => eprintln!("ERROR: {}", e), - Ok(_) => {} + if let Err(e) = real_main() { + eprintln!("ERROR: {}", e); } } diff --git a/src/bin/passport.rs b/src/bin/passport.rs index 65c23e1..1f23bf7 100644 --- a/src/bin/passport.rs +++ b/src/bin/passport.rs @@ -172,8 +172,7 @@ fn real_main() -> Result<(), TopLevelError> { } fn main() { - match real_main() { - Err(e) => eprintln!("ERROR: {}", e), - Ok(_) => {} + if let Err(e) = real_main() { + eprintln!("ERROR: {}", e); } } diff --git a/src/bin/password_check.rs b/src/bin/password_check.rs index 23fcdb1..1814c20 100644 --- a/src/bin/password_check.rs +++ b/src/bin/password_check.rs @@ -99,8 +99,7 @@ fn real_main() -> Result<(), TopLevelError> { } fn main() { - match real_main() { - Err(e) => eprintln!("ERROR: {}", e), - Ok(_) => {} + if let Err(e) = real_main() { + eprintln!("ERROR: {}", e); } } diff --git a/src/bin/tobaggan.rs b/src/bin/tobaggan.rs index 81a7bd9..7dc46f0 100644 --- a/src/bin/tobaggan.rs +++ b/src/bin/tobaggan.rs @@ -93,8 +93,7 @@ fn real_main() -> Result<(), TopLevelError> { } fn main() { - match real_main() { - Err(e) => eprintln!("ERROR: {}", e), - Ok(_) => {} + if let Err(e) = real_main() { + eprintln!("ERROR: {}", e); } } diff --git a/src/errors.rs b/src/errors.rs index 70e2400..030c786 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,4 +1,3 @@ -use nom; use std::fmt; use std::io; use std::num::ParseIntError; diff --git a/src/map.rs b/src/map.rs index 86ccc4c..8715cb5 100644 --- a/src/map.rs +++ b/src/map.rs @@ -30,10 +30,8 @@ where _height += 1; if width == 0 { width = current_line.len(); - } else { - if width != current_line.len() { - return Err(E::from(MapParseError::UnevenLines(_height))); - } + } else if width != current_line.len() { + return Err(E::from(MapParseError::UnevenLines(_height))); } data.push(current_line); }