From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 4/4] http: sync: drop unused &self parameter
Date: Fri, 3 Mar 2023 12:39:24 +0100 [thread overview]
Message-ID: <20230303113924.389256-5-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20230303113924.389256-1-f.gruenbichler@proxmox.com>
these are just internal helpers, changing their signature is fine.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
proxmox-http/src/client/sync.rs | 31 ++++++++++++++-----------------
1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/proxmox-http/src/client/sync.rs b/proxmox-http/src/client/sync.rs
index 3485f84..ea081a7 100644
--- a/proxmox-http/src/client/sync.rs
+++ b/proxmox-http/src/client/sync.rs
@@ -33,11 +33,11 @@ impl Client {
Ok(builder.build())
}
- fn call(&self, req: ureq::Request) -> Result<ureq::Response, Error> {
+ fn call(req: ureq::Request) -> Result<ureq::Response, Error> {
req.call().map_err(Into::into)
}
- fn send<R>(&self, req: ureq::Request, body: R) -> Result<ureq::Response, Error>
+ fn send<R>(req: ureq::Request, body: R) -> Result<ureq::Response, Error>
where
R: Read,
{
@@ -105,7 +105,7 @@ impl HttpClient<String, String> for Client {
let req = self.agent()?.get(uri);
let req = Self::add_headers(req, None, extra_headers);
- self.call(req).and_then(Self::convert_response_to_string)
+ Self::call(req).and_then(Self::convert_response_to_string)
}
fn post(
@@ -119,8 +119,8 @@ impl HttpClient<String, String> for Client {
let req = Self::add_headers(req, content_type, extra_headers);
match body {
- Some(body) => self.send(req, body.as_bytes()),
- None => self.call(req),
+ Some(body) => Self::send(req, body.as_bytes()),
+ None => Self::call(req),
}
.and_then(Self::convert_response_to_string)
}
@@ -138,8 +138,7 @@ impl HttpClient<String, String> for Client {
}
}
- self.send(req, request.body().as_bytes())
- .and_then(Self::convert_response_to_string)
+ Self::send(req, request.body().as_bytes()).and_then(Self::convert_response_to_string)
}
}
@@ -152,7 +151,7 @@ impl HttpClient<&[u8], Vec<u8>> for Client {
let req = self.agent()?.get(uri);
let req = Self::add_headers(req, None, extra_headers);
- self.call(req).and_then(Self::convert_response_to_vec)
+ Self::call(req).and_then(Self::convert_response_to_vec)
}
fn post(
@@ -166,8 +165,8 @@ impl HttpClient<&[u8], Vec<u8>> for Client {
let req = Self::add_headers(req, content_type, extra_headers);
match body {
- Some(body) => self.send(req, body),
- None => self.call(req),
+ Some(body) => Self::send(req, body),
+ None => Self::call(req),
}
.and_then(Self::convert_response_to_vec)
}
@@ -185,8 +184,7 @@ impl HttpClient<&[u8], Vec<u8>> for Client {
}
}
- self.send(req, *request.body())
- .and_then(Self::convert_response_to_vec)
+ Self::send(req, *request.body()).and_then(Self::convert_response_to_vec)
}
}
@@ -199,7 +197,7 @@ impl HttpClient<Box<dyn Read>, Box<dyn Read>> for Client {
let req = self.agent()?.get(uri);
let req = Self::add_headers(req, None, extra_headers);
- self.call(req).and_then(Self::convert_response_to_reader)
+ Self::call(req).and_then(Self::convert_response_to_reader)
}
fn post(
@@ -213,8 +211,8 @@ impl HttpClient<Box<dyn Read>, Box<dyn Read>> for Client {
let req = Self::add_headers(req, content_type, extra_headers);
match body {
- Some(body) => self.send(req, body),
- None => self.call(req),
+ Some(body) => Self::send(req, body),
+ None => Self::call(req),
}
.and_then(Self::convert_response_to_reader)
}
@@ -234,7 +232,6 @@ impl HttpClient<Box<dyn Read>, Box<dyn Read>> for Client {
}
}
- self.send(req, Box::new(request.body_mut()))
- .and_then(Self::convert_response_to_reader)
+ Self::send(req, Box::new(request.body_mut())).and_then(Self::convert_response_to_reader)
}
}
--
2.30.2
next prev parent reply other threads:[~2023-03-03 11:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 11:39 [pbs-devel] [PATCH proxmox 0/4] http: sync: user-agent improvements Fabian Grünbichler
2023-03-03 11:39 ` [pbs-devel] [PATCH proxmox 1/4] http: sync: set user-agent via ureq agent Fabian Grünbichler
2023-03-03 11:39 ` [pbs-devel] [PATCH proxmox 2/4] http: sync: remove redundant calls for setting User-Agent Fabian Grünbichler
2023-03-03 11:39 ` [pbs-devel] [PATCH proxmox 3/4] http: sync: derive default user-agent from crate version Fabian Grünbichler
2023-03-07 8:40 ` Wolfgang Bumiller
2023-03-03 11:39 ` Fabian Grünbichler [this message]
2023-03-07 8:31 ` [pbs-devel] applied-series: [PATCH proxmox 0/4] http: sync: user-agent improvements Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230303113924.389256-5-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox