aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorTeddy Wing2017-04-13 03:17:29 +0200
committerTeddy Wing2017-04-13 03:17:29 +0200
commit7af8adc2e3e18595caa19ce6d336a22196535993 (patch)
treea6b1f0a81f1136ec90a51cdf49b2cbff1b7e814b /src/main.rs
parentefa7f80d962aa0f55f3addbac1da206538d9242e (diff)
downloadHearURL-7af8adc2e3e18595caa19ce6d336a22196535993.tar.bz2
main.rs: Clean up `main` error handling
Remove the `match` call from efa7f80d962aa0f55f3addbac1da206538d9242e and use `unwrap_or_else` instead since we don't need to do anything extra in the `Ok` case.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index f126839..b4c7781 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -31,11 +31,8 @@ fn open_stream() -> io::Result<()> {
}
fn main() {
- match open_stream() {
- Ok(_) => {},
- Err(e) => {
- writeln!(io::stderr(), "{}", e)
- .expect("Failed printing to stderr");
- },
- }
+ open_stream().unwrap_or_else(|e| {
+ writeln!(io::stderr(), "{}", e)
+ .expect("Failed printing to stderr");
+ });
}