diff options
author | bold <bold@cryptoguru.com> | 2020-01-16 09:13:43 +0100 |
---|---|---|
committer | Wez Furlong <wez@wezfurlong.org> | 2020-01-18 08:40:18 -0800 |
commit | e43324f3488f7ee095bdbb149e45d7da1eb0ab03 (patch) | |
tree | 8fba5792392bfb8a97e5626dd51ab3f4f51318d9 | |
parent | c14a8838606b49fbe6aa39892701372b788d9945 (diff) | |
download | ssh2-rs-e43324f3488f7ee095bdbb149e45d7da1eb0ab03.zip |
simplify function signature
-rw-r--r-- | src/sftp.rs | 8 |
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) } } |