aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/pinentry.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-11 01:30:24 +0000
committerDaniel Mueller <deso@posteo.net>2019-01-13 19:43:38 -0800
commit5bb115f0b2021b0f7a58e064d66e0a6ad67c5654 (patch)
tree7830af30855ccbaf3a14c44b78b7343d172ec717 /nitrocli/src/pinentry.rs
parentd64d379e97a600c08b1e145f6f986aaf95ddcc8f (diff)
downloadnitrocli-5bb115f0b2021b0f7a58e064d66e0a6ad67c5654.tar.gz
nitrocli-5bb115f0b2021b0f7a58e064d66e0a6ad67c5654.tar.bz2
Implement From<&str> for Error
This patch implements From<&str> for Error so that we can use Error::from(s) as a shorthand for Error::Error(s.to_string()). It also replaces Error::Error with Error::from where possible.
Diffstat (limited to 'nitrocli/src/pinentry.rs')
-rw-r--r--nitrocli/src/pinentry.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/nitrocli/src/pinentry.rs b/nitrocli/src/pinentry.rs
index 8ea4298..232bff9 100644
--- a/nitrocli/src/pinentry.rs
+++ b/nitrocli/src/pinentry.rs
@@ -134,7 +134,7 @@ where
// specially.
if !lines.is_empty() && lines[0].starts_with("ERR ") {
let (_, error) = lines[0].split_at(4);
- return Err(Error::Error(error.to_string()));
+ return Err(Error::from(error));
}
Err(Error::Error(format!("Unexpected response: {}", string)))
}