]> git.proxmox.com Git - proxmox-backup.git/commitdiff
vsock_client: remove some &mut restrictions and rustfmt
authorStefan Reiter <s.reiter@proxmox.com>
Wed, 31 Mar 2021 10:21:45 +0000 (12:21 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 1 Apr 2021 09:09:28 +0000 (11:09 +0200)
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
src/client/vsock_client.rs

index 5002b53dc08502fdcedd60960a4b2b3753315fe5..a7740ac2233ddc17e045e8ba9e8fc6bfa5f93bc5 100644 (file)
@@ -12,7 +12,7 @@ use hyper::client::Client;
 use hyper::Body;
 use pin_project::pin_project;
 use serde_json::Value;
-use tokio::io::{ReadBuf, AsyncRead, AsyncWrite, AsyncWriteExt};
+use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt, ReadBuf};
 use tokio::net::UnixStream;
 
 use crate::tools;
@@ -151,13 +151,13 @@ impl VsockClient {
         self.api_request(req).await
     }
 
-    pub async fn post(&mut self, path: &str, data: Option<Value>) -> Result<Value, Error> {
+    pub async fn post(&self, path: &str, data: Option<Value>) -> Result<Value, Error> {
         let req = Self::request_builder(self.cid, self.port, "POST", path, data)?;
         self.api_request(req).await
     }
 
     pub async fn download(
-        &mut self,
+        &self,
         path: &str,
         data: Option<Value>,
         output: &mut (dyn AsyncWrite + Send + Unpin),
@@ -166,14 +166,13 @@ impl VsockClient {
 
         let client = self.client.clone();
 
-        let resp = client.request(req)
+        let resp = client
+            .request(req)
             .await
             .map_err(|_| format_err!("vsock download request timed out"))?;
         let status = resp.status();
         if !status.is_success() {
-            Self::api_response(resp)
-                .await
-                .map(|_| ())?
+            Self::api_response(resp).await.map(|_| ())?
         } else {
             resp.into_body()
                 .map_err(Error::from)