[pbs-devel] [PATCH proxmox 09/15] clippy fix: unnecessary use of `to_string`

Lukas Wagner l.wagner at proxmox.com
Tue Aug 8 10:01:47 CEST 2023


See:
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned

Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
 proxmox-openid/src/http_client.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/proxmox-openid/src/http_client.rs b/proxmox-openid/src/http_client.rs
index e391421..1850d64 100644
--- a/proxmox-openid/src/http_client.rs
+++ b/proxmox-openid/src/http_client.rs
@@ -54,15 +54,15 @@ fn ureq_agent() -> Result<ureq::Agent, Error> {
 pub fn http_client(request: HttpRequest) -> Result<HttpResponse, Error> {
     let agent = ureq_agent()?;
     let mut req = if let Method::POST = request.method {
-        agent.post(&request.url.to_string())
+        agent.post(request.url.as_ref())
     } else {
-        agent.get(&request.url.to_string())
+        agent.get(request.url.as_ref())
     };
 
     for (name, value) in request.headers {
         if let Some(name) = name {
             req = req.set(
-                &name.to_string(),
+                name.as_ref(),
                 value.to_str().map_err(|_| {
                     Error::Other(format!(
                         "invalid {} header value {:?}",
-- 
2.39.2






More information about the pbs-devel mailing list