diff options
author | Daniel Mueller <deso@posteo.net> | 2019-01-06 16:58:32 -0800 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-01-06 16:58:32 -0800 |
commit | 25258409c09d408c1ccd332ffcdb6ed0e183f54d (patch) | |
tree | 788ad33842368ab14d92cb8b047c683b1c8dd4ac | |
parent | 9dffcc7b3d119ec444a1e5b4c4e219be9c77a8be (diff) | |
download | nitrocli-25258409c09d408c1ccd332ffcdb6ed0e183f54d.tar.gz nitrocli-25258409c09d408c1ccd332ffcdb6ed0e183f54d.tar.bz2 |
Properly report io::Error objects
We have a Result::unwrap in the error path of handling io::Error
objects. I have actually seen that fail, masking the original error. We
should not unwrap there and in fact we don't have to, as io::Error
implements fmt::Display just fine.
This may have changed in the past, as the construct we had is much more
convoluted than necessary and would only have been written if a direct
formatting was not possible.
-rw-r--r-- | nitrocli/src/error.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/nitrocli/src/error.rs b/nitrocli/src/error.rs index d86a635..738e689 100644 --- a/nitrocli/src/error.rs +++ b/nitrocli/src/error.rs @@ -1,7 +1,7 @@ // error.rs // ************************************************************************* -// * Copyright (C) 2017-2018 Daniel Mueller (deso@posteo.net) * +// * Copyright (C) 2017-2019 Daniel Mueller (deso@posteo.net) * // * * // * This program is free software: you can redistribute it and/or modify * // * it under the terms of the GNU General Public License as published by * @@ -46,7 +46,7 @@ impl fmt::Display for Error { match *self { Error::ArgparseError(_) => write!(f, "Could not parse arguments"), Error::Utf8Error(_) => write!(f, "Encountered UTF-8 conversion error"), - Error::IoError(ref e) => write!(f, "IO error: {}", e.get_ref().unwrap()), + Error::IoError(ref e) => write!(f, "IO error: {}", e), Error::Error(ref e) => write!(f, "{}", e), } } |