summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbold <bold@cryptoguru.com>2020-01-16 09:13:43 +0100
committerWez Furlong <wez@wezfurlong.org>2020-01-18 08:40:18 -0800
commite43324f3488f7ee095bdbb149e45d7da1eb0ab03 (patch)
tree8fba5792392bfb8a97e5626dd51ab3f4f51318d9
parentc14a8838606b49fbe6aa39892701372b788d9945 (diff)
downloadssh2-rs-e43324f3488f7ee095bdbb149e45d7da1eb0ab03.zip
simplify function signature
-rw-r--r--src/sftp.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sftp.rs b/src/sftp.rs
index 17576c3..e5448ab 100644
--- a/src/sftp.rs
+++ b/src/sftp.rs
@@ -146,7 +146,7 @@ impl Sftp {
open_type as c_int,
);
if ret.is_null() {
- Err(self.last_session_error()?.unwrap_or_else(Error::unknown))
+ Err(self.last_session_error())
} else {
Ok(File::from_raw(self, ret))
}
@@ -377,11 +377,11 @@ impl Sftp {
Error::from_errno(code as c_int)
}
- fn last_session_error(&self) -> Result<Option<Error>, Error> {
+ fn last_session_error(&self) -> Error {
if let Some(inner) = self.inner.as_ref() {
- Ok(Error::last_error_raw(inner.sess.raw))
+ Error::last_error_raw(inner.sess.raw).unwrap_or_else(Error::unknown)
} else {
- Err(Error::from_errno(raw::LIBSSH2_ERROR_BAD_USE))
+ Error::from_errno(raw::LIBSSH2_ERROR_BAD_USE)
}
}