remove unnecessary double-colons

This commit is contained in:
Daniel Eades
2019-08-16 19:54:09 +01:00
committed by Sean McArthur
parent 06353fbb1a
commit 4bb4149b63
12 changed files with 70 additions and 70 deletions

View File

@@ -48,7 +48,7 @@ impl Body {
#[inline] #[inline]
pub(crate) fn empty() -> Body { pub(crate) fn empty() -> Body {
Body::wrap(::hyper::Body::empty()) Body::wrap(hyper::Body::empty())
} }
#[inline] #[inline]
@@ -145,7 +145,7 @@ where
{ {
#[inline] #[inline]
fn from(s: Box<dyn Stream<Item = I, Error = E> + Send>) -> Body { fn from(s: Box<dyn Stream<Item = I, Error = E> + Send>) -> Body {
Body::wrap(::hyper::Body::wrap_stream(s)) Body::wrap(hyper::Body::wrap_stream(s))
} }
} }
@@ -204,7 +204,7 @@ impl Extend<u8> for Chunk {
impl IntoIterator for Chunk { impl IntoIterator for Chunk {
type Item = u8; type Item = u8;
//XXX: exposing type from hyper! //XXX: exposing type from hyper!
type IntoIter = <::hyper::Chunk as IntoIterator>::IntoIter; type IntoIter = <hyper::Chunk as IntoIterator>::IntoIter;
fn into_iter(self) -> Self::IntoIter { fn into_iter(self) -> Self::IntoIter {
self.inner.into_iter() self.inner.into_iter()
} }

View File

@@ -481,7 +481,7 @@ mod tests {
.part("key1", Part::text("value1")) .part("key1", Part::text("value1"))
.part( .part(
"key2", "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("reader2", Part::stream(futures::stream::once::<_, hyper::Error>(Ok(hyper::Chunk::from("part2".to_owned())))))
.part( .part(
@@ -515,12 +515,12 @@ mod tests {
std::str::from_utf8(&out).unwrap() std::str::from_utf8(&out).unwrap()
); );
println!("START EXPECTED\n{}\nEND EXPECTED", expected); 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] #[test]
fn stream_to_end_with_header() { 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()); part.meta.headers.insert("Hdr3", "/a/b/c".parse().unwrap());
let mut form = Form::new().part("key2", part); let mut form = Form::new().part("key2", part);
form.inner.boundary = "boundary".to_string(); form.inner.boundary = "boundary".to_string();

View File

@@ -37,7 +37,7 @@ pub struct Response {
} }
impl Response { impl Response {
pub(super) fn new(res: hyper::Response<::hyper::Body>, url: Url, gzip: bool, timeout: Option<Delay>) -> Response { pub(super) fn new(res: hyper::Response<hyper::Body>, url: Url, gzip: bool, timeout: Option<Delay>) -> Response {
let (parts, body) = res.into_parts(); let (parts, body) = res.into_parts();
let status = parts.status; let status = parts.status;
let version = parts.version; let version = parts.version;

View File

@@ -387,7 +387,7 @@ pub(crate) type Conn = Box<dyn AsyncConn + Send + Sync + 'static>;
pub(crate) type Connecting = Box<dyn Future<Item=(Conn, Connected), Error=io::Error> + Send>; pub(crate) type Connecting = Box<dyn Future<Item=(Conn, Connected), Error=io::Error> + Send>;
#[cfg(feature = "tls")] #[cfg(feature = "tls")]
fn tunnel<T>(conn: T, host: String, port: u16, auth: Option<::http::header::HeaderValue>) -> Tunnel<T> { fn tunnel<T>(conn: T, host: String, port: u16, auth: Option<http::header::HeaderValue>) -> Tunnel<T> {
let mut buf = format!("\ let mut buf = format!("\
CONNECT {0}:{1} HTTP/1.1\r\n\ CONNECT {0}:{1} HTTP/1.1\r\n\
Host: {0}:{1}\r\n\ Host: {0}:{1}\r\n\

View File

@@ -389,22 +389,22 @@ impl StdError for Error {
#[derive(Debug)] #[derive(Debug)]
pub(crate) enum Kind { pub(crate) enum Kind {
Http(::http::Error), Http(http::Error),
Hyper(::hyper::Error), Hyper(hyper::Error),
Mime(::mime::FromStrError), Mime(mime::FromStrError),
Url(::url::ParseError), Url(url::ParseError),
UrlBadScheme, UrlBadScheme,
#[cfg(all(feature = "default-tls", feature = "rustls-tls"))] #[cfg(all(feature = "default-tls", feature = "rustls-tls"))]
TlsIncompatible, TlsIncompatible,
#[cfg(feature = "default-tls")] #[cfg(feature = "default-tls")]
NativeTls(::native_tls::Error), NativeTls(native_tls::Error),
#[cfg(feature = "rustls-tls")] #[cfg(feature = "rustls-tls")]
Rustls(::rustls::TLSError), Rustls(rustls::TLSError),
#[cfg(feature = "trust-dns")] #[cfg(feature = "trust-dns")]
DnsSystemConf(io::Error), DnsSystemConf(io::Error),
Io(io::Error), Io(io::Error),
UrlEncoded(::serde_urlencoded::ser::Error), UrlEncoded(serde_urlencoded::ser::Error),
Json(::serde_json::Error), Json(serde_json::Error),
TooManyRedirects, TooManyRedirects,
RedirectLoop, RedirectLoop,
Status(StatusCode), Status(StatusCode),
@@ -414,21 +414,21 @@ pub(crate) enum Kind {
} }
impl From<::http::Error> for Kind { impl From<http::Error> for Kind {
#[inline] #[inline]
fn from(err: http::Error) -> Kind { fn from(err: http::Error) -> Kind {
Kind::Http(err) Kind::Http(err)
} }
} }
impl From<::hyper::Error> for Kind { impl From<hyper::Error> for Kind {
#[inline] #[inline]
fn from(err: hyper::Error) -> Kind { fn from(err: hyper::Error) -> Kind {
Kind::Hyper(err) Kind::Hyper(err)
} }
} }
impl From<::mime::FromStrError> for Kind { impl From<mime::FromStrError> for Kind {
#[inline] #[inline]
fn from(err: mime::FromStrError) -> Kind { fn from(err: mime::FromStrError) -> Kind {
Kind::Mime(err) Kind::Mime(err)
@@ -442,21 +442,21 @@ impl From<io::Error> for Kind {
} }
} }
impl From<::url::ParseError> for Kind { impl From<url::ParseError> for Kind {
#[inline] #[inline]
fn from(err: url::ParseError) -> Kind { fn from(err: url::ParseError) -> Kind {
Kind::Url(err) Kind::Url(err)
} }
} }
impl From<::serde_urlencoded::ser::Error> for Kind { impl From<serde_urlencoded::ser::Error> for Kind {
#[inline] #[inline]
fn from(err: serde_urlencoded::ser::Error) -> Kind { fn from(err: serde_urlencoded::ser::Error) -> Kind {
Kind::UrlEncoded(err) Kind::UrlEncoded(err)
} }
} }
impl From<::serde_json::Error> for Kind { impl From<serde_json::Error> for Kind {
#[inline] #[inline]
fn from(err: serde_json::Error) -> Kind { fn from(err: serde_json::Error) -> Kind {
Kind::Json(err) Kind::Json(err)
@@ -464,14 +464,14 @@ impl From<::serde_json::Error> for Kind {
} }
#[cfg(feature = "default-tls")] #[cfg(feature = "default-tls")]
impl From<::native_tls::Error> for Kind { impl From<native_tls::Error> for Kind {
fn from(err: native_tls::Error) -> Kind { fn from(err: native_tls::Error) -> Kind {
Kind::NativeTls(err) Kind::NativeTls(err)
} }
} }
#[cfg(feature = "rustls-tls")] #[cfg(feature = "rustls-tls")]
impl From<::rustls::TLSError> for Kind { impl From<rustls::TLSError> for Kind {
fn from(err: rustls::TLSError) -> Kind { fn from(err: rustls::TLSError) -> Kind {
Kind::Rustls(err) Kind::Rustls(err)
} }
@@ -494,7 +494,7 @@ impl From<EnterError> for Kind {
} }
} }
impl From<::tokio::timer::Error> for Kind { impl From<tokio::timer::Error> for Kind {
fn from(_err: tokio::timer::Error) -> Kind { fn from(_err: tokio::timer::Error) -> Kind {
Kind::Timer Kind::Timer
} }
@@ -577,7 +577,7 @@ macro_rules! try_io {
match $e { match $e {
Ok(v) => v, Ok(v) => v,
Err(ref err) if err.kind() == std::io::ErrorKind::WouldBlock => { Err(ref err) if err.kind() == std::io::ErrorKind::WouldBlock => {
return Ok(::futures::Async::NotReady); return Ok(futures::Async::NotReady);
} }
Err(err) => { Err(err) => {
return Err(crate::error::from_io(err)); return Err(crate::error::from_io(err));
@@ -653,15 +653,15 @@ mod tests {
} }
let root = Chain(None::<Error>); let root = Chain(None::<Error>);
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); let err = Error::new(Kind::Io(io), None);
assert!(err.cause().is_none()); assert!(err.cause().is_none());
assert_eq!(err.to_string(), "root"); assert_eq!(err.to_string(), "root");
let root = std::io::Error::new(::std::io::ErrorKind::Other, Chain(None::<Error>)); let root = std::io::Error::new(std::io::ErrorKind::Other, Chain(None::<Error>));
let link = Chain(Some(root)); 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); let err = Error::new(Kind::Io(io), None);
assert!(err.cause().is_some()); assert!(err.cause().is_some());
assert_eq!(err.to_string(), "chain: root"); assert_eq!(err.to_string(), "chain: root");

View File

@@ -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") 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<hyper::Uri> {
url.as_str().parse().ok() url.as_str().parse().ok()
} }

View File

@@ -377,13 +377,13 @@ mod tests {
fn read_to_end() { fn read_to_end() {
let mut output = Vec::new(); let mut output = Vec::new();
let mut form = Form::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("key1", Part::text("value1"))
.part( .part(
"key2", "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( .part(
"key3", "key3",
Part::text("value3").file_name("filename"), Part::text("value3").file_name("filename"),
@@ -413,7 +413,7 @@ mod tests {
std::str::from_utf8(&output).unwrap() std::str::from_utf8(&output).unwrap()
); );
println!("START EXPECTED\n{}\nEND EXPECTED", expected); 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()); assert!(length.is_none());
} }
@@ -424,7 +424,7 @@ mod tests {
.text("key1", "value1") .text("key1", "value1")
.part( .part(
"key2", "key2",
Part::text("value2").mime(::mime::IMAGE_BMP), Part::text("value2").mime(mime::IMAGE_BMP),
) )
.part( .part(
"key3", "key3",
@@ -449,14 +449,14 @@ mod tests {
std::str::from_utf8(&output).unwrap() std::str::from_utf8(&output).unwrap()
); );
println!("START EXPECTED\n{}\nEND EXPECTED", expected); 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); assert_eq!(length.unwrap(), expected.len() as u64);
} }
#[test] #[test]
fn read_to_end_with_header() { fn read_to_end_with_header() {
let mut output = Vec::new(); 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()); part.meta.headers.insert("Hdr3", "/a/b/c".parse().unwrap());
let mut form = Form::new().part("key2", part); let mut form = Form::new().part("key2", part);
form.inner.boundary = "boundary".to_string(); form.inner.boundary = "boundary".to_string();
@@ -474,6 +474,6 @@ mod tests {
std::str::from_utf8(&output).unwrap() std::str::from_utf8(&output).unwrap()
); );
println!("START EXPECTED\n{}\nEND EXPECTED", expected); 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);
} }
} }

View File

@@ -26,7 +26,7 @@ use winreg::RegKey;
/// For instance, let's look at `Proxy::http`: /// For instance, let's look at `Proxy::http`:
/// ///
/// ```rust /// ```rust
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let proxy = reqwest::Proxy::http("https://secure.example")?; /// let proxy = reqwest::Proxy::http("https://secure.example")?;
/// # Ok(()) /// # Ok(())
/// # } /// # }
@@ -88,7 +88,7 @@ impl Proxy {
/// ///
/// ``` /// ```
/// # extern crate reqwest; /// # extern crate reqwest;
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let client = reqwest::Client::builder() /// let client = reqwest::Client::builder()
/// .proxy(reqwest::Proxy::http("https://my.prox")?) /// .proxy(reqwest::Proxy::http("https://my.prox")?)
/// .build()?; /// .build()?;
@@ -108,7 +108,7 @@ impl Proxy {
/// ///
/// ``` /// ```
/// # extern crate reqwest; /// # extern crate reqwest;
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let client = reqwest::Client::builder() /// let client = reqwest::Client::builder()
/// .proxy(reqwest::Proxy::https("https://example.prox:4545")?) /// .proxy(reqwest::Proxy::https("https://example.prox:4545")?)
/// .build()?; /// .build()?;
@@ -128,7 +128,7 @@ impl Proxy {
/// ///
/// ``` /// ```
/// # extern crate reqwest; /// # extern crate reqwest;
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let client = reqwest::Client::builder() /// let client = reqwest::Client::builder()
/// .proxy(reqwest::Proxy::all("http://pro.xy")?) /// .proxy(reqwest::Proxy::all("http://pro.xy")?)
/// .build()?; /// .build()?;
@@ -148,7 +148,7 @@ impl Proxy {
/// ///
/// ``` /// ```
/// # extern crate reqwest; /// # extern crate reqwest;
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let target = reqwest::Url::parse("https://my.prox")?; /// let target = reqwest::Url::parse("https://my.prox")?;
/// let client = reqwest::Client::builder() /// let client = reqwest::Client::builder()
/// .proxy(reqwest::Proxy::custom(move |url| { /// .proxy(reqwest::Proxy::custom(move |url| {
@@ -190,7 +190,7 @@ impl Proxy {
/// ///
/// ``` /// ```
/// # extern crate reqwest; /// # extern crate reqwest;
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let proxy = reqwest::Proxy::https("http://localhost:1234")? /// let proxy = reqwest::Proxy::https("http://localhost:1234")?
/// .basic_auth("Aladdin", "open sesame"); /// .basic_auth("Aladdin", "open sesame");
/// # Ok(()) /// # Ok(())

View File

@@ -130,7 +130,7 @@ impl RequestBuilder {
/// ```rust /// ```rust
/// use reqwest::header::USER_AGENT; /// use reqwest::header::USER_AGENT;
/// ///
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let client = reqwest::Client::new(); /// let client = reqwest::Client::new();
/// let res = client.get("https://www.rust-lang.org") /// let res = client.get("https://www.rust-lang.org")
/// .header(USER_AGENT, "foo") /// .header(USER_AGENT, "foo")
@@ -176,7 +176,7 @@ impl RequestBuilder {
/// headers /// headers
/// } /// }
/// ///
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let file = fs::File::open("much_beauty.png")?; /// let file = fs::File::open("much_beauty.png")?;
/// let client = reqwest::Client::new(); /// let client = reqwest::Client::new();
/// let res = client.post("http://httpbin.org/post") /// let res = client.post("http://httpbin.org/post")
@@ -221,7 +221,7 @@ impl RequestBuilder {
/// Enable HTTP basic authentication. /// Enable HTTP basic authentication.
/// ///
/// ```rust /// ```rust
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let client = reqwest::Client::new(); /// let client = reqwest::Client::new();
/// let resp = client.delete("http://httpbin.org/delete") /// let resp = client.delete("http://httpbin.org/delete")
/// .basic_auth("admin", Some("good password")) /// .basic_auth("admin", Some("good password"))
@@ -245,7 +245,7 @@ impl RequestBuilder {
/// Enable HTTP bearer authentication. /// Enable HTTP bearer authentication.
/// ///
/// ```rust /// ```rust
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let client = reqwest::Client::new(); /// let client = reqwest::Client::new();
/// let resp = client.delete("http://httpbin.org/delete") /// let resp = client.delete("http://httpbin.org/delete")
/// .bearer_auth("token") /// .bearer_auth("token")
@@ -268,7 +268,7 @@ impl RequestBuilder {
/// Using a string: /// Using a string:
/// ///
/// ```rust /// ```rust
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let client = reqwest::Client::new(); /// let client = reqwest::Client::new();
/// let res = client.post("http://httpbin.org/post") /// let res = client.post("http://httpbin.org/post")
/// .body("from a &str!") /// .body("from a &str!")
@@ -281,7 +281,7 @@ impl RequestBuilder {
/// ///
/// ```rust /// ```rust
/// # use std::fs; /// # use std::fs;
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let file = fs::File::open("from_a_file.txt")?; /// let file = fs::File::open("from_a_file.txt")?;
/// let client = reqwest::Client::new(); /// let client = reqwest::Client::new();
/// let res = client.post("http://httpbin.org/post") /// let res = client.post("http://httpbin.org/post")
@@ -295,7 +295,7 @@ impl RequestBuilder {
/// ///
/// ```rust /// ```rust
/// # use std::fs; /// # use std::fs;
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// // from bytes! /// // from bytes!
/// let bytes: Vec<u8> = vec![1, 10, 100]; /// let bytes: Vec<u8> = vec![1, 10, 100];
/// let client = reqwest::Client::new(); /// let client = reqwest::Client::new();
@@ -517,7 +517,7 @@ impl RequestBuilder {
/// With a static body /// With a static body
/// ///
/// ```rust /// ```rust
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let client = reqwest::Client::new(); /// let client = reqwest::Client::new();
/// let builder = client.post("http://httpbin.org/post") /// let builder = client.post("http://httpbin.org/post")
/// .body("from a &str!"); /// .body("from a &str!");
@@ -530,7 +530,7 @@ impl RequestBuilder {
/// Without a body /// Without a body
/// ///
/// ```rust /// ```rust
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let client = reqwest::Client::new(); /// let client = reqwest::Client::new();
/// let builder = client.get("http://httpbin.org/get"); /// let builder = client.get("http://httpbin.org/get");
/// let clone = builder.try_clone(); /// let clone = builder.try_clone();
@@ -542,7 +542,7 @@ impl RequestBuilder {
/// With a non-clonable body /// With a non-clonable body
/// ///
/// ```rust /// ```rust
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let client = reqwest::Client::new(); /// let client = reqwest::Client::new();
/// let builder = client.get("http://httpbin.org/get") /// let builder = client.get("http://httpbin.org/get")
/// .body(reqwest::Body::new(std::io::empty())); /// .body(reqwest::Body::new(std::io::empty()));

View File

@@ -44,7 +44,7 @@ impl Response {
/// Checking for general status class: /// Checking for general status class:
/// ///
/// ```rust /// ```rust
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let resp = reqwest::get("http://httpbin.org/get")?; /// let resp = reqwest::get("http://httpbin.org/get")?;
/// if resp.status().is_success() { /// if resp.status().is_success() {
/// println!("success!"); /// println!("success!");
@@ -62,7 +62,7 @@ impl Response {
/// ```rust /// ```rust
/// use reqwest::Client; /// use reqwest::Client;
/// use reqwest::StatusCode; /// use reqwest::StatusCode;
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let client = Client::new(); /// let client = Client::new();
/// ///
/// let resp = client.post("http://httpbin.org/post") /// let resp = client.post("http://httpbin.org/post")
@@ -94,7 +94,7 @@ impl Response {
/// use reqwest::Client; /// use reqwest::Client;
/// use reqwest::header::ETAG; /// use reqwest::header::ETAG;
/// ///
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let client = Client::new(); /// let client = Client::new();
/// ///
/// let mut resp = client.get("http://httpbin.org/cache").send()?; /// let mut resp = client.get("http://httpbin.org/cache").send()?;
@@ -133,7 +133,7 @@ impl Response {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let resp = reqwest::get("http://httpbin.org/redirect/1")?; /// let resp = reqwest::get("http://httpbin.org/redirect/1")?;
/// assert_eq!(resp.url().as_str(), "http://httpbin.org/get"); /// assert_eq!(resp.url().as_str(), "http://httpbin.org/get");
/// # Ok(()) /// # Ok(())
@@ -149,7 +149,7 @@ impl Response {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let resp = reqwest::get("http://httpbin.org/redirect/1")?; /// let resp = reqwest::get("http://httpbin.org/redirect/1")?;
/// println!("httpbin.org address: {:?}", resp.remote_addr()); /// println!("httpbin.org address: {:?}", resp.remote_addr());
/// # Ok(()) /// # Ok(())
@@ -222,7 +222,7 @@ impl Response {
/// ///
/// ```rust /// ```rust
/// # extern crate reqwest; /// # extern crate reqwest;
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let content = reqwest::get("http://httpbin.org/range/26")?.text()?; /// let content = reqwest::get("http://httpbin.org/range/26")?.text()?;
/// # Ok(()) /// # Ok(())
/// # } /// # }
@@ -249,7 +249,7 @@ impl Response {
/// ///
/// ```rust /// ```rust
/// # extern crate reqwest; /// # extern crate reqwest;
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let content = reqwest::get("http://httpbin.org/range/26")?.text_with_charset("utf-8")?; /// let content = reqwest::get("http://httpbin.org/range/26")?.text_with_charset("utf-8")?;
/// # Ok(()) /// # Ok(())
/// # } /// # }
@@ -281,7 +281,7 @@ impl Response {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let mut resp = reqwest::get("http://httpbin.org/range/5")?; /// let mut resp = reqwest::get("http://httpbin.org/range/5")?;
/// let mut buf: Vec<u8> = vec![]; /// let mut buf: Vec<u8> = vec![];
/// resp.copy_to(&mut buf)?; /// resp.copy_to(&mut buf)?;
@@ -302,7 +302,7 @@ impl Response {
/// ///
/// ```rust,no_run /// ```rust,no_run
/// # extern crate reqwest; /// # extern crate reqwest;
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let res = reqwest::get("http://httpbin.org/status/400")? /// let res = reqwest::get("http://httpbin.org/status/400")?
/// .error_for_status(); /// .error_for_status();
/// if let Err(err) = res { /// if let Err(err) = res {
@@ -331,7 +331,7 @@ impl Response {
/// ///
/// ```rust,no_run /// ```rust,no_run
/// # extern crate reqwest; /// # extern crate reqwest;
/// # fn run() -> Result<(), Box<::std::error::Error>> { /// # fn run() -> Result<(), Box<std::error::Error>> {
/// let res = reqwest::get("http://httpbin.org/status/400")?; /// let res = reqwest::get("http://httpbin.org/status/400")?;
/// let res = res.error_for_status_ref(); /// let res = res.error_for_status_ref();
/// if let Err(err) = res { /// if let Err(err) = res {

View File

@@ -27,11 +27,11 @@ pub struct Identity {
enum ClientCert { enum ClientCert {
#[cfg(feature = "default-tls")] #[cfg(feature = "default-tls")]
Pkcs12(::native_tls::Identity), Pkcs12(native_tls::Identity),
#[cfg(feature = "rustls-tls")] #[cfg(feature = "rustls-tls")]
Pem { Pem {
key: rustls::PrivateKey, key: rustls::PrivateKey,
certs: Vec<::rustls::Certificate>, certs: Vec<rustls::Certificate>,
} }
} }
@@ -55,7 +55,7 @@ impl Certificate {
pub fn from_der(der: &[u8]) -> crate::Result<Certificate> { pub fn from_der(der: &[u8]) -> crate::Result<Certificate> {
Ok(Certificate { Ok(Certificate {
#[cfg(feature = "default-tls")] #[cfg(feature = "default-tls")]
native: try_!(::native_tls::Certificate::from_der(der)), native: try_!(native_tls::Certificate::from_der(der)),
#[cfg(feature = "rustls-tls")] #[cfg(feature = "rustls-tls")]
original: Cert::Der(der.to_owned()), original: Cert::Der(der.to_owned()),
}) })
@@ -81,7 +81,7 @@ impl Certificate {
pub fn from_pem(pem: &[u8]) -> crate::Result<Certificate> { pub fn from_pem(pem: &[u8]) -> crate::Result<Certificate> {
Ok(Certificate { Ok(Certificate {
#[cfg(feature = "default-tls")] #[cfg(feature = "default-tls")]
native: try_!(::native_tls::Certificate::from_pem(pem)), native: try_!(native_tls::Certificate::from_pem(pem)),
#[cfg(feature = "rustls-tls")] #[cfg(feature = "rustls-tls")]
original: Cert::Pem(pem.to_owned()) original: Cert::Pem(pem.to_owned())
}) })
@@ -152,7 +152,7 @@ impl Identity {
pub fn from_pkcs12_der(der: &[u8], password: &str) -> crate::Result<Identity> { pub fn from_pkcs12_der(der: &[u8], password: &str) -> crate::Result<Identity> {
Ok(Identity { Ok(Identity {
inner: ClientCert::Pkcs12( inner: ClientCert::Pkcs12(
try_!(::native_tls::Identity::from_pkcs12(der, password)) try_!(native_tls::Identity::from_pkcs12(der, password))
), ),
}) })
} }

View File

@@ -97,7 +97,7 @@ pub fn spawn(txns: Vec<Txn>) -> 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)) => { (Ok(expected), Ok(received)) => {
if expected.len() > 300 && std::env::var("REQWEST_TEST_BODY_FULL").is_err() { if expected.len() > 300 && std::env::var("REQWEST_TEST_BODY_FULL").is_err() {
assert_eq!( assert_eq!(