diff options
author | Teddy Wing | 2017-05-07 13:22:35 +0200 |
---|---|---|
committer | Teddy Wing | 2017-05-07 13:27:29 +0200 |
commit | 09d7aa3f3dc1a2b9241bc0ec62bee029b8942dc1 (patch) | |
tree | 5e5204752e05ef310eef24fed3a595cfbbcf1fdd | |
parent | e9f04e34f55c66890ad3d5351b36ad0cf914b7de (diff) | |
download | HearURL-09d7aa3f3dc1a2b9241bc0ec62bee029b8942dc1.tar.bz2 |
main.rs: Match `Option` when setting browser
Instead of checking for the presence of the `-b` option before setting
it, just use an `Option` match since `opt_str` returns an
`Option<String>`.
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index 183079a..c6e7054 100644 --- a/src/main.rs +++ b/src/main.rs @@ -57,11 +57,12 @@ fn main() { return } - let browser = if opt_matches.opt_present("b") { - opt_matches.opt_str("b") - } else { - print_usage(opts); - return + let browser = match opt_matches.opt_str("b") { + Some(b) => b, + None => { + print_usage(opts); + return + }, }; open_stream().unwrap_or_else(|e| { |