diff --git a/src/async_impl/body.rs b/src/async_impl/body.rs index 47e88bb..d118e66 100644 --- a/src/async_impl/body.rs +++ b/src/async_impl/body.rs @@ -48,7 +48,7 @@ impl Body { #[inline] pub(crate) fn empty() -> Body { - Body::wrap(::hyper::Body::empty()) + Body::wrap(hyper::Body::empty()) } #[inline] @@ -145,7 +145,7 @@ where { #[inline] fn from(s: Box + Send>) -> Body { - Body::wrap(::hyper::Body::wrap_stream(s)) + Body::wrap(hyper::Body::wrap_stream(s)) } } @@ -204,7 +204,7 @@ impl Extend for Chunk { impl IntoIterator for Chunk { type Item = u8; //XXX: exposing type from hyper! - type IntoIter = <::hyper::Chunk as IntoIterator>::IntoIter; + type IntoIter = ::IntoIter; fn into_iter(self) -> Self::IntoIter { self.inner.into_iter() } diff --git a/src/async_impl/multipart.rs b/src/async_impl/multipart.rs index d222469..198a016 100644 --- a/src/async_impl/multipart.rs +++ b/src/async_impl/multipart.rs @@ -481,7 +481,7 @@ mod tests { .part("key1", Part::text("value1")) .part( "key2", - Part::text("value2").mime(::mime::IMAGE_BMP), + Part::text("value2").mime(mime::IMAGE_BMP), ) .part("reader2", Part::stream(futures::stream::once::<_, hyper::Error>(Ok(hyper::Chunk::from("part2".to_owned()))))) .part( @@ -515,12 +515,12 @@ mod tests { std::str::from_utf8(&out).unwrap() ); println!("START EXPECTED\n{}\nEND EXPECTED", expected); - assert_eq!(::std::str::from_utf8(&out).unwrap(), expected); + assert_eq!(std::str::from_utf8(&out).unwrap(), expected); } #[test] fn stream_to_end_with_header() { - let mut part = Part::text("value2").mime(::mime::IMAGE_BMP); + let mut part = Part::text("value2").mime(mime::IMAGE_BMP); part.meta.headers.insert("Hdr3", "/a/b/c".parse().unwrap()); let mut form = Form::new().part("key2", part); form.inner.boundary = "boundary".to_string(); diff --git a/src/async_impl/response.rs b/src/async_impl/response.rs index 1634118..481213a 100644 --- a/src/async_impl/response.rs +++ b/src/async_impl/response.rs @@ -37,7 +37,7 @@ pub struct Response { } impl Response { - pub(super) fn new(res: hyper::Response<::hyper::Body>, url: Url, gzip: bool, timeout: Option) -> Response { + pub(super) fn new(res: hyper::Response, url: Url, gzip: bool, timeout: Option) -> Response { let (parts, body) = res.into_parts(); let status = parts.status; let version = parts.version; diff --git a/src/connect.rs b/src/connect.rs index 846e31e..5d2b9a2 100644 --- a/src/connect.rs +++ b/src/connect.rs @@ -387,7 +387,7 @@ pub(crate) type Conn = Box; pub(crate) type Connecting = Box + Send>; #[cfg(feature = "tls")] -fn tunnel(conn: T, host: String, port: u16, auth: Option<::http::header::HeaderValue>) -> Tunnel { +fn tunnel(conn: T, host: String, port: u16, auth: Option) -> Tunnel { let mut buf = format!("\ CONNECT {0}:{1} HTTP/1.1\r\n\ Host: {0}:{1}\r\n\ diff --git a/src/error.rs b/src/error.rs index 01eabf9..47127a7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -389,22 +389,22 @@ impl StdError for Error { #[derive(Debug)] pub(crate) enum Kind { - Http(::http::Error), - Hyper(::hyper::Error), - Mime(::mime::FromStrError), - Url(::url::ParseError), + Http(http::Error), + Hyper(hyper::Error), + Mime(mime::FromStrError), + Url(url::ParseError), UrlBadScheme, #[cfg(all(feature = "default-tls", feature = "rustls-tls"))] TlsIncompatible, #[cfg(feature = "default-tls")] - NativeTls(::native_tls::Error), + NativeTls(native_tls::Error), #[cfg(feature = "rustls-tls")] - Rustls(::rustls::TLSError), + Rustls(rustls::TLSError), #[cfg(feature = "trust-dns")] DnsSystemConf(io::Error), Io(io::Error), - UrlEncoded(::serde_urlencoded::ser::Error), - Json(::serde_json::Error), + UrlEncoded(serde_urlencoded::ser::Error), + Json(serde_json::Error), TooManyRedirects, RedirectLoop, Status(StatusCode), @@ -414,21 +414,21 @@ pub(crate) enum Kind { } -impl From<::http::Error> for Kind { +impl From for Kind { #[inline] fn from(err: http::Error) -> Kind { Kind::Http(err) } } -impl From<::hyper::Error> for Kind { +impl From for Kind { #[inline] fn from(err: hyper::Error) -> Kind { Kind::Hyper(err) } } -impl From<::mime::FromStrError> for Kind { +impl From for Kind { #[inline] fn from(err: mime::FromStrError) -> Kind { Kind::Mime(err) @@ -442,21 +442,21 @@ impl From for Kind { } } -impl From<::url::ParseError> for Kind { +impl From for Kind { #[inline] fn from(err: url::ParseError) -> Kind { Kind::Url(err) } } -impl From<::serde_urlencoded::ser::Error> for Kind { +impl From for Kind { #[inline] fn from(err: serde_urlencoded::ser::Error) -> Kind { Kind::UrlEncoded(err) } } -impl From<::serde_json::Error> for Kind { +impl From for Kind { #[inline] fn from(err: serde_json::Error) -> Kind { Kind::Json(err) @@ -464,14 +464,14 @@ impl From<::serde_json::Error> for Kind { } #[cfg(feature = "default-tls")] -impl From<::native_tls::Error> for Kind { +impl From for Kind { fn from(err: native_tls::Error) -> Kind { Kind::NativeTls(err) } } #[cfg(feature = "rustls-tls")] -impl From<::rustls::TLSError> for Kind { +impl From for Kind { fn from(err: rustls::TLSError) -> Kind { Kind::Rustls(err) } @@ -494,7 +494,7 @@ impl From for Kind { } } -impl From<::tokio::timer::Error> for Kind { +impl From for Kind { fn from(_err: tokio::timer::Error) -> Kind { Kind::Timer } @@ -577,7 +577,7 @@ macro_rules! try_io { match $e { Ok(v) => v, Err(ref err) if err.kind() == std::io::ErrorKind::WouldBlock => { - return Ok(::futures::Async::NotReady); + return Ok(futures::Async::NotReady); } Err(err) => { return Err(crate::error::from_io(err)); @@ -653,15 +653,15 @@ mod tests { } let root = Chain(None::); - let io = std::io::Error::new(::std::io::ErrorKind::Other, root); + let io = std::io::Error::new(std::io::ErrorKind::Other, root); let err = Error::new(Kind::Io(io), None); assert!(err.cause().is_none()); assert_eq!(err.to_string(), "root"); - let root = std::io::Error::new(::std::io::ErrorKind::Other, Chain(None::)); + let root = std::io::Error::new(std::io::ErrorKind::Other, Chain(None::)); let link = Chain(Some(root)); - let io = std::io::Error::new(::std::io::ErrorKind::Other, link); + let io = std::io::Error::new(std::io::ErrorKind::Other, link); let err = Error::new(Kind::Io(io), None); assert!(err.cause().is_some()); assert_eq!(err.to_string(), "chain: root"); diff --git a/src/into_url.rs b/src/into_url.rs index 1c66332..b5c7149 100644 --- a/src/into_url.rs +++ b/src/into_url.rs @@ -42,7 +42,7 @@ pub(crate) fn expect_uri(url: &Url) -> hyper::Uri { url.as_str().parse().expect("a parsed Url should always be a valid Uri") } -pub(crate) fn try_uri(url: &Url) -> Option<::hyper::Uri> { +pub(crate) fn try_uri(url: &Url) -> Option { url.as_str().parse().ok() } diff --git a/src/multipart.rs b/src/multipart.rs index fe06264..6090b6a 100644 --- a/src/multipart.rs +++ b/src/multipart.rs @@ -377,13 +377,13 @@ mod tests { fn read_to_end() { let mut output = Vec::new(); let mut form = Form::new() - .part("reader1", Part::reader(::std::io::empty())) + .part("reader1", Part::reader(std::io::empty())) .part("key1", Part::text("value1")) .part( "key2", - Part::text("value2").mime(::mime::IMAGE_BMP), + Part::text("value2").mime(mime::IMAGE_BMP), ) - .part("reader2", Part::reader(::std::io::empty())) + .part("reader2", Part::reader(std::io::empty())) .part( "key3", Part::text("value3").file_name("filename"), @@ -413,7 +413,7 @@ mod tests { std::str::from_utf8(&output).unwrap() ); println!("START EXPECTED\n{}\nEND EXPECTED", expected); - assert_eq!(::std::str::from_utf8(&output).unwrap(), expected); + assert_eq!(std::str::from_utf8(&output).unwrap(), expected); assert!(length.is_none()); } @@ -424,7 +424,7 @@ mod tests { .text("key1", "value1") .part( "key2", - Part::text("value2").mime(::mime::IMAGE_BMP), + Part::text("value2").mime(mime::IMAGE_BMP), ) .part( "key3", @@ -449,14 +449,14 @@ mod tests { std::str::from_utf8(&output).unwrap() ); println!("START EXPECTED\n{}\nEND EXPECTED", expected); - assert_eq!(::std::str::from_utf8(&output).unwrap(), expected); + assert_eq!(std::str::from_utf8(&output).unwrap(), expected); assert_eq!(length.unwrap(), expected.len() as u64); } #[test] fn read_to_end_with_header() { let mut output = Vec::new(); - let mut part = Part::text("value2").mime(::mime::IMAGE_BMP); + let mut part = Part::text("value2").mime(mime::IMAGE_BMP); part.meta.headers.insert("Hdr3", "/a/b/c".parse().unwrap()); let mut form = Form::new().part("key2", part); form.inner.boundary = "boundary".to_string(); @@ -474,6 +474,6 @@ mod tests { std::str::from_utf8(&output).unwrap() ); println!("START EXPECTED\n{}\nEND EXPECTED", expected); - assert_eq!(::std::str::from_utf8(&output).unwrap(), expected); + assert_eq!(std::str::from_utf8(&output).unwrap(), expected); } } diff --git a/src/proxy.rs b/src/proxy.rs index 6234341..907f70d 100644 --- a/src/proxy.rs +++ b/src/proxy.rs @@ -26,7 +26,7 @@ use winreg::RegKey; /// For instance, let's look at `Proxy::http`: /// /// ```rust -/// # fn run() -> Result<(), Box<::std::error::Error>> { +/// # fn run() -> Result<(), Box> { /// let proxy = reqwest::Proxy::http("https://secure.example")?; /// # Ok(()) /// # } @@ -88,7 +88,7 @@ impl Proxy { /// /// ``` /// # extern crate reqwest; - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let client = reqwest::Client::builder() /// .proxy(reqwest::Proxy::http("https://my.prox")?) /// .build()?; @@ -108,7 +108,7 @@ impl Proxy { /// /// ``` /// # extern crate reqwest; - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let client = reqwest::Client::builder() /// .proxy(reqwest::Proxy::https("https://example.prox:4545")?) /// .build()?; @@ -128,7 +128,7 @@ impl Proxy { /// /// ``` /// # extern crate reqwest; - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let client = reqwest::Client::builder() /// .proxy(reqwest::Proxy::all("http://pro.xy")?) /// .build()?; @@ -148,7 +148,7 @@ impl Proxy { /// /// ``` /// # extern crate reqwest; - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let target = reqwest::Url::parse("https://my.prox")?; /// let client = reqwest::Client::builder() /// .proxy(reqwest::Proxy::custom(move |url| { @@ -190,7 +190,7 @@ impl Proxy { /// /// ``` /// # extern crate reqwest; - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let proxy = reqwest::Proxy::https("http://localhost:1234")? /// .basic_auth("Aladdin", "open sesame"); /// # Ok(()) diff --git a/src/request.rs b/src/request.rs index e3f5574..fb6def8 100644 --- a/src/request.rs +++ b/src/request.rs @@ -130,7 +130,7 @@ impl RequestBuilder { /// ```rust /// use reqwest::header::USER_AGENT; /// - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let client = reqwest::Client::new(); /// let res = client.get("https://www.rust-lang.org") /// .header(USER_AGENT, "foo") @@ -176,7 +176,7 @@ impl RequestBuilder { /// headers /// } /// - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let file = fs::File::open("much_beauty.png")?; /// let client = reqwest::Client::new(); /// let res = client.post("http://httpbin.org/post") @@ -221,7 +221,7 @@ impl RequestBuilder { /// Enable HTTP basic authentication. /// /// ```rust - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let client = reqwest::Client::new(); /// let resp = client.delete("http://httpbin.org/delete") /// .basic_auth("admin", Some("good password")) @@ -245,7 +245,7 @@ impl RequestBuilder { /// Enable HTTP bearer authentication. /// /// ```rust - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let client = reqwest::Client::new(); /// let resp = client.delete("http://httpbin.org/delete") /// .bearer_auth("token") @@ -268,7 +268,7 @@ impl RequestBuilder { /// Using a string: /// /// ```rust - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let client = reqwest::Client::new(); /// let res = client.post("http://httpbin.org/post") /// .body("from a &str!") @@ -281,7 +281,7 @@ impl RequestBuilder { /// /// ```rust /// # use std::fs; - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let file = fs::File::open("from_a_file.txt")?; /// let client = reqwest::Client::new(); /// let res = client.post("http://httpbin.org/post") @@ -295,7 +295,7 @@ impl RequestBuilder { /// /// ```rust /// # use std::fs; - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// // from bytes! /// let bytes: Vec = vec![1, 10, 100]; /// let client = reqwest::Client::new(); @@ -517,7 +517,7 @@ impl RequestBuilder { /// With a static body /// /// ```rust - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let client = reqwest::Client::new(); /// let builder = client.post("http://httpbin.org/post") /// .body("from a &str!"); @@ -530,7 +530,7 @@ impl RequestBuilder { /// Without a body /// /// ```rust - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let client = reqwest::Client::new(); /// let builder = client.get("http://httpbin.org/get"); /// let clone = builder.try_clone(); @@ -542,7 +542,7 @@ impl RequestBuilder { /// With a non-clonable body /// /// ```rust - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let client = reqwest::Client::new(); /// let builder = client.get("http://httpbin.org/get") /// .body(reqwest::Body::new(std::io::empty())); diff --git a/src/response.rs b/src/response.rs index 913a18a..754b7ac 100644 --- a/src/response.rs +++ b/src/response.rs @@ -44,7 +44,7 @@ impl Response { /// Checking for general status class: /// /// ```rust - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let resp = reqwest::get("http://httpbin.org/get")?; /// if resp.status().is_success() { /// println!("success!"); @@ -62,7 +62,7 @@ impl Response { /// ```rust /// use reqwest::Client; /// use reqwest::StatusCode; - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let client = Client::new(); /// /// let resp = client.post("http://httpbin.org/post") @@ -94,7 +94,7 @@ impl Response { /// use reqwest::Client; /// use reqwest::header::ETAG; /// - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let client = Client::new(); /// /// let mut resp = client.get("http://httpbin.org/cache").send()?; @@ -133,7 +133,7 @@ impl Response { /// # Example /// /// ```rust - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let resp = reqwest::get("http://httpbin.org/redirect/1")?; /// assert_eq!(resp.url().as_str(), "http://httpbin.org/get"); /// # Ok(()) @@ -149,7 +149,7 @@ impl Response { /// # Example /// /// ```rust - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let resp = reqwest::get("http://httpbin.org/redirect/1")?; /// println!("httpbin.org address: {:?}", resp.remote_addr()); /// # Ok(()) @@ -222,7 +222,7 @@ impl Response { /// /// ```rust /// # extern crate reqwest; - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let content = reqwest::get("http://httpbin.org/range/26")?.text()?; /// # Ok(()) /// # } @@ -249,7 +249,7 @@ impl Response { /// /// ```rust /// # extern crate reqwest; - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let content = reqwest::get("http://httpbin.org/range/26")?.text_with_charset("utf-8")?; /// # Ok(()) /// # } @@ -281,7 +281,7 @@ impl Response { /// # Example /// /// ```rust - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let mut resp = reqwest::get("http://httpbin.org/range/5")?; /// let mut buf: Vec = vec![]; /// resp.copy_to(&mut buf)?; @@ -302,7 +302,7 @@ impl Response { /// /// ```rust,no_run /// # extern crate reqwest; - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let res = reqwest::get("http://httpbin.org/status/400")? /// .error_for_status(); /// if let Err(err) = res { @@ -331,7 +331,7 @@ impl Response { /// /// ```rust,no_run /// # extern crate reqwest; - /// # fn run() -> Result<(), Box<::std::error::Error>> { + /// # fn run() -> Result<(), Box> { /// let res = reqwest::get("http://httpbin.org/status/400")?; /// let res = res.error_for_status_ref(); /// if let Err(err) = res { diff --git a/src/tls.rs b/src/tls.rs index 8adb33a..0d174bc 100644 --- a/src/tls.rs +++ b/src/tls.rs @@ -27,11 +27,11 @@ pub struct Identity { enum ClientCert { #[cfg(feature = "default-tls")] - Pkcs12(::native_tls::Identity), + Pkcs12(native_tls::Identity), #[cfg(feature = "rustls-tls")] Pem { key: rustls::PrivateKey, - certs: Vec<::rustls::Certificate>, + certs: Vec, } } @@ -55,7 +55,7 @@ impl Certificate { pub fn from_der(der: &[u8]) -> crate::Result { Ok(Certificate { #[cfg(feature = "default-tls")] - native: try_!(::native_tls::Certificate::from_der(der)), + native: try_!(native_tls::Certificate::from_der(der)), #[cfg(feature = "rustls-tls")] original: Cert::Der(der.to_owned()), }) @@ -81,7 +81,7 @@ impl Certificate { pub fn from_pem(pem: &[u8]) -> crate::Result { Ok(Certificate { #[cfg(feature = "default-tls")] - native: try_!(::native_tls::Certificate::from_pem(pem)), + native: try_!(native_tls::Certificate::from_pem(pem)), #[cfg(feature = "rustls-tls")] original: Cert::Pem(pem.to_owned()) }) @@ -152,7 +152,7 @@ impl Identity { pub fn from_pkcs12_der(der: &[u8], password: &str) -> crate::Result { Ok(Identity { inner: ClientCert::Pkcs12( - try_!(::native_tls::Identity::from_pkcs12(der, password)) + try_!(native_tls::Identity::from_pkcs12(der, password)) ), }) } diff --git a/tests/support/server.rs b/tests/support/server.rs index af8d345..bb43736 100644 --- a/tests/support/server.rs +++ b/tests/support/server.rs @@ -97,7 +97,7 @@ pub fn spawn(txns: Vec) -> Server { } } - match (::std::str::from_utf8(&expected), std::str::from_utf8(&buf[..n])) { + match (std::str::from_utf8(&expected), std::str::from_utf8(&buf[..n])) { (Ok(expected), Ok(received)) => { if expected.len() > 300 && std::env::var("REQWEST_TEST_BODY_FULL").is_err() { assert_eq!(