diff options
author | bold <bold@cryptoguru.com> | 2020-01-16 09:08:13 +0100 |
---|---|---|
committer | Wez Furlong <wez@wezfurlong.org> | 2020-01-18 08:40:18 -0800 |
commit | a5aabc7e5d7d92b1c7d9e311dc731e451bda8e20 (patch) | |
tree | c9d6e48263b99674c499f0a81f3ab2f72c499755 | |
parent | 756a61d0271402ec642d6fdb866fbb92e2d4a876 (diff) | |
download | ssh2-rs-a5aabc7e5d7d92b1c7d9e311dc731e451bda8e20.zip |
use take instead of as_ref
-rw-r--r-- | src/sftp.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sftp.rs b/src/sftp.rs index ef6ff1d..83fdd07 100644 --- a/src/sftp.rs +++ b/src/sftp.rs @@ -413,7 +413,7 @@ impl Sftp { impl Drop for Sftp { fn drop(&mut self) { // Set ssh2 to blocking if sftp was not shutdown yet. - if let Some(inner) = self.inner.as_ref() { + if let Some(inner) = self.inner.take() { let was_blocking = inner.sess.is_blocking(); if !was_blocking { inner.sess.set_blocking(true); @@ -612,7 +612,7 @@ impl<'sftp> Seek for File<'sftp> { impl<'sftp> Drop for File<'sftp> { fn drop(&mut self) { // Set ssh2 to blocking if the file was not closed yet. - if let Some(inner) = self.inner.as_ref() { + if let Some(inner) = self.inner.take() { // Normally sftp should still be available here. The only way it is `None` is when // shutdown has been polled until success. In this case the async client should // also properly poll `close` on `File` until success. |