From 9d854fc5baad01d059acdb96fad82700042ef114 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 11 Jan 2019 01:30:24 +0000 Subject: 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. --- nitrocli/src/pinentry.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nitrocli/src/pinentry.rs') 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))) } -- cgit v1.2.1