clippy fix: unnecessary use of to_string
See: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
This commit is contained in:
committed by
Wolfgang Bumiller
parent
b272279ef1
commit
8f7566209c
@ -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 {:?}",
|
||||
|
Reference in New Issue
Block a user