aboutsummaryrefslogtreecommitdiff
path: root/src/tests/mod.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2020-07-08 09:16:56 -0700
committerDaniel Mueller <deso@posteo.net>2020-07-08 09:16:56 -0700
commiteb4419bfd990f0abe75e5e7c248fe1e7efa0843a (patch)
tree3d0256f65ff317e9d0f41816d2841692e8743cac /src/tests/mod.rs
parent1abd0153b5fbacf5fff89406dc34924f84205c3a (diff)
downloadnitrocli-eb4419bfd990f0abe75e5e7c248fe1e7efa0843a.tar.gz
nitrocli-eb4419bfd990f0abe75e5e7c248fe1e7efa0843a.tar.bz2
Remove unwrap_str_err method from UnwrapError test trait
With upcoming changes we intend to move towards a model where we do not distinguish the individual error variants the program deals with in a global enum. In preparation of such a change, this patch marks a first step in removing the UnwrapError test trait, which relies on the existence of exactly such typed errors. In particular, we remove the unwrap_str_err method from it, basically falling back to just working with strings.
Diffstat (limited to 'src/tests/mod.rs')
-rw-r--r--src/tests/mod.rs16
1 files changed, 0 insertions, 16 deletions
diff --git a/src/tests/mod.rs b/src/tests/mod.rs
index abf63e3..fd2f9e0 100644
--- a/src/tests/mod.rs
+++ b/src/tests/mod.rs
@@ -37,8 +37,6 @@ mod unencrypted;
/// A trait simplifying checking for expected errors.
pub trait UnwrapError {
- /// Unwrap an Error::Error variant.
- fn unwrap_str_err(self) -> String;
/// Unwrap a Error::CommandError variant.
fn unwrap_cmd_err(self) -> (Option<&'static str>, nitrokey::CommandError);
/// Unwrap a Error::LibraryError variant.
@@ -49,20 +47,6 @@ impl<T> UnwrapError for crate::Result<T>
where
T: fmt::Debug,
{
- fn unwrap_str_err(self) -> String {
- match self.unwrap_err() {
- crate::Error::ClapError(err) => {
- if err.use_stderr() {
- err.message
- } else {
- String::new()
- }
- }
- crate::Error::Error(err) => err,
- err => panic!("Unexpected error variant found: {:?}", err),
- }
- }
-
fn unwrap_cmd_err(self) -> (Option<&'static str>, nitrokey::CommandError) {
match self.unwrap_err() {
crate::Error::NitrokeyError(ctx, err) => match err {