cargo fmt (#604)

Run rustfmt and setup CI to check for it.
This commit is contained in:
danieleades
2019-08-29 17:52:39 +01:00
committed by Sean McArthur
parent 81e0f1ff2a
commit cf8944a0f0
41 changed files with 1399 additions and 1378 deletions

View File

@@ -1,5 +1,3 @@
extern crate reqwest;
#[macro_use]
mod support;
@@ -37,7 +35,10 @@ fn http_proxy() {
assert_eq!(res.url().as_str(), url);
assert_eq!(res.status(), reqwest::StatusCode::OK);
assert_eq!(res.headers().get(reqwest::header::SERVER).unwrap(), &"proxied");
assert_eq!(
res.headers().get(reqwest::header::SERVER).unwrap(),
&"proxied"
);
}
#[test]
@@ -66,8 +67,8 @@ fn http_proxy_basic_auth() {
let res = reqwest::Client::builder()
.proxy(
reqwest::Proxy::http(&proxy)
.unwrap()
.basic_auth("Aladdin", "open sesame")
.unwrap()
.basic_auth("Aladdin", "open sesame"),
)
.build()
.unwrap()
@@ -77,7 +78,10 @@ fn http_proxy_basic_auth() {
assert_eq!(res.url().as_str(), url);
assert_eq!(res.status(), reqwest::StatusCode::OK);
assert_eq!(res.headers().get(reqwest::header::SERVER).unwrap(), &"proxied");
assert_eq!(
res.headers().get(reqwest::header::SERVER).unwrap(),
&"proxied"
);
}
#[test]
@@ -104,9 +108,7 @@ fn http_proxy_basic_auth_parsed() {
let url = "http://hyper.rs/prox";
let res = reqwest::Client::builder()
.proxy(
reqwest::Proxy::http(&proxy).unwrap()
)
.proxy(reqwest::Proxy::http(&proxy).unwrap())
.build()
.unwrap()
.get(url)
@@ -115,7 +117,10 @@ fn http_proxy_basic_auth_parsed() {
assert_eq!(res.url().as_str(), url);
assert_eq!(res.status(), reqwest::StatusCode::OK);
assert_eq!(res.headers().get(reqwest::header::SERVER).unwrap(), &"proxied");
assert_eq!(
res.headers().get(reqwest::header::SERVER).unwrap(),
&"proxied"
);
}
#[test]
@@ -141,9 +146,7 @@ fn test_no_proxy() {
// set up proxy and use no_proxy to clear up client builder proxies.
let res = reqwest::Client::builder()
.proxy(
reqwest::Proxy::http(&proxy).unwrap()
)
.proxy(reqwest::Proxy::http(&proxy).unwrap())
.no_proxy()
.build()
.unwrap()
@@ -189,11 +192,14 @@ fn test_using_system_proxy() {
assert_eq!(res.url().as_str(), url);
assert_eq!(res.status(), reqwest::StatusCode::OK);
assert_eq!(res.headers().get(reqwest::header::SERVER).unwrap(), &"proxied");
assert_eq!(
res.headers().get(reqwest::header::SERVER).unwrap(),
&"proxied"
);
// reset user setting.
match system_proxy {
Err(_) => env::remove_var("http_proxy"),
Ok(proxy) => env::set_var("http_proxy", proxy)
Ok(proxy) => env::set_var("http_proxy", proxy),
}
}