From a5aabc7e5d7d92b1c7d9e311dc731e451bda8e20 Mon Sep 17 00:00:00 2001 From: bold Date: Thu, 16 Jan 2020 09:08:13 +0100 Subject: use take instead of as_ref --- src/sftp.rs | 4 ++-- 1 file 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. -- cgit v1.2.3