diff options
author | Daniel Mueller <deso@posteo.net> | 2019-02-08 18:11:52 -0800 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-02-08 18:11:52 -0800 |
commit | d8477e9f1f8d687f7e8cecd3abf634304a6b351f (patch) | |
tree | 6a04a97b7728bbd64fea467b655081571b75a1ce | |
parent | 49fa7c5924e22bad4077d376f158e0468d0b6cf4 (diff) | |
download | nitrocli-d8477e9f1f8d687f7e8cecd3abf634304a6b351f.tar.gz nitrocli-d8477e9f1f8d687f7e8cecd3abf634304a6b351f.tar.bz2 |
Simplify error handling in the parse function
This patch changes the error handling in the args' module parse function
to use the Result's map_err instead of a more verbose if let expression.
-rw-r--r-- | nitrocli/src/args.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs index 43f866d..3331779 100644 --- a/nitrocli/src/args.rs +++ b/nitrocli/src/args.rs @@ -177,11 +177,9 @@ fn parse( args: Vec<String>, ) -> Result<()> { let (stdout, stderr) = ctx.stdio(); - if let Err(err) = parser.parse(args, stdout, stderr) { - Err(Error::ArgparseError(err)) - } else { - Ok(()) - } + parser + .parse(args, stdout, stderr) + .map_err(Error::ArgparseError) } /// Inquire the status of the nitrokey. |