From 78f827faea6cbc0a76a6ad1f16becb66aceaae0f Mon Sep 17 00:00:00 2001 From: Chip Senkbeil Date: Mon, 11 Oct 2021 00:12:08 -0500 Subject: [PATCH] Fix clippy warning --- Cargo.lock | 8 ++++---- distant-ssh2/src/lib.rs | 11 +++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9af6fb7..88e25bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -427,7 +427,7 @@ dependencies = [ [[package]] name = "distant" -version = "0.15.0-alpha.12" +version = "0.15.0-alpha.14" dependencies = [ "assert_cmd", "assert_fs", @@ -451,7 +451,7 @@ dependencies = [ [[package]] name = "distant-core" -version = "0.15.0-alpha.12" +version = "0.15.0-alpha.14" dependencies = [ "assert_fs", "bytes", @@ -476,7 +476,7 @@ dependencies = [ [[package]] name = "distant-lua" -version = "0.15.0-alpha.12" +version = "0.15.0-alpha.14" dependencies = [ "distant-core", "distant-ssh2", @@ -510,7 +510,7 @@ dependencies = [ [[package]] name = "distant-ssh2" -version = "0.15.0-alpha.12" +version = "0.15.0-alpha.14" dependencies = [ "assert_cmd", "assert_fs", diff --git a/distant-ssh2/src/lib.rs b/distant-ssh2/src/lib.rs index e8582fa..510fb48 100644 --- a/distant-ssh2/src/lib.rs +++ b/distant-ssh2/src/lib.rs @@ -412,16 +412,16 @@ impl Ssh2Session { // Close out ssh session session.abort(); let _ = session.wait().await; + let mut output = String::new(); // If successful, grab the session information and establish a connection // with the distant server if success { - let mut out = String::new(); while let Ok(data) = stdout.read().await { - out.push_str(&data); + output.push_str(&data); } - let maybe_info = out + let maybe_info = output .lines() .find_map(|line| line.parse::().ok()); match maybe_info { @@ -450,9 +450,8 @@ impl Ssh2Session { )), } } else { - let mut err = String::new(); while let Ok(data) = stderr.read().await { - err.push_str(&data); + output.push_str(&data); } Err(io::Error::new( @@ -461,7 +460,7 @@ impl Ssh2Session { "Spawning distant failed [{}]: {}", code.map(|x| x.to_string()) .unwrap_or_else(|| String::from("???")), - err + output ), )) }