cargo fix --edition

This commit is contained in:
Daniel Eades
2019-08-07 18:07:35 +01:00
committed by Sean McArthur
parent c3b2a26c46
commit 86d9cbc66e
25 changed files with 163 additions and 163 deletions

View File

@@ -72,7 +72,7 @@ impl Body {
impl Stream for Body {
type Item = Chunk;
type Error = ::Error;
type Error = crate::Error;
#[inline]
fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
@@ -80,10 +80,10 @@ impl Stream for Body {
Inner::Hyper { ref mut body, ref mut timeout } => {
if let Some(ref mut timeout) = timeout {
if let Async::Ready(()) = try_!(timeout.poll()) {
return Err(::error::timedout(None));
return Err(crate::error::timedout(None));
}
}
try_ready!(body.poll_data().map_err(::error::from))
try_ready!(body.poll_data().map_err(crate::error::from))
},
Inner::Reusable(ref mut bytes) => {
return if bytes.is_empty() {

View File

@@ -5,7 +5,7 @@ use std::net::IpAddr;
use bytes::Bytes;
use futures::{Async, Future, Poll};
use header::{
use crate::header::{
Entry,
HeaderMap,
HeaderValue,
@@ -31,16 +31,16 @@ use tokio::{clock, timer::Delay};
use super::request::{Request, RequestBuilder};
use super::response::Response;
use connect::Connector;
use into_url::{expect_uri, try_uri};
use cookie;
use redirect::{self, RedirectPolicy, remove_sensitive_headers};
use {IntoUrl, Method, Proxy, StatusCode, Url};
use ::proxy::get_proxies;
use crate::connect::Connector;
use crate::into_url::{expect_uri, try_uri};
use crate::cookie;
use crate::redirect::{self, RedirectPolicy, remove_sensitive_headers};
use crate::{IntoUrl, Method, Proxy, StatusCode, Url};
use crate::proxy::get_proxies;
#[cfg(feature = "tls")]
use {Certificate, Identity};
use crate::{Certificate, Identity};
#[cfg(feature = "tls")]
use ::tls::TlsBackend;
use crate::tls::TlsBackend;
static DEFAULT_USER_AGENT: &'static str =
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
@@ -133,7 +133,7 @@ impl ClientBuilder {
///
/// This method fails if TLS backend cannot be initialized, or the resolver
/// cannot load the system configuration.
pub fn build(self) -> ::Result<Client> {
pub fn build(self) -> crate::Result<Client> {
let config = self.config;
let proxies = Arc::new(config.proxies);
@@ -545,7 +545,7 @@ impl Client {
///
/// This method fails if there was an error while sending request,
/// redirect loop was detected or redirect limit was exhausted.
pub fn execute(&self, request: Request) -> impl Future<Item = Response, Error = ::Error> {
pub fn execute(&self, request: Request) -> impl Future<Item = Response, Error = crate::Error> {
self.execute_request(request)
}
@@ -568,7 +568,7 @@ impl Client {
// Add cookies from the cookie store.
if let Some(cookie_store_wrapper) = self.inner.cookie_store.as_ref() {
if headers.get(::header::COOKIE).is_none() {
if headers.get(crate::header::COOKIE).is_none() {
let cookie_store = cookie_store_wrapper.read().unwrap();
add_cookie_header(&mut headers, &cookie_store, &url);
}
@@ -695,7 +695,7 @@ pub(super) struct Pending {
enum PendingInner {
Request(PendingRequest),
Error(Option<::Error>),
Error(Option<crate::Error>),
}
struct PendingRequest {
@@ -713,7 +713,7 @@ struct PendingRequest {
}
impl Pending {
pub(super) fn new_err(err: ::Error) -> Pending {
pub(super) fn new_err(err: crate::Error) -> Pending {
Pending {
inner: PendingInner::Error(Some(err)),
}
@@ -722,7 +722,7 @@ impl Pending {
impl Future for Pending {
type Item = Response;
type Error = ::Error;
type Error = crate::Error;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
match self.inner {
@@ -734,12 +734,12 @@ impl Future for Pending {
impl Future for PendingRequest {
type Item = Response;
type Error = ::Error;
type Error = crate::Error;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
if let Some(ref mut delay) = self.timeout {
if let Async::Ready(()) = try_!(delay.poll(), &self.url) {
return Err(::error::timedout(Some(self.url.clone())));
return Err(crate::error::timedout(Some(self.url.clone())));
}
}
@@ -850,10 +850,10 @@ impl Future for PendingRequest {
debug!("redirect_policy disallowed redirection to '{}'", loc);
},
redirect::Action::LoopDetected => {
return Err(::error::loop_detected(self.url.clone()));
return Err(crate::error::loop_detected(self.url.clone()));
},
redirect::Action::TooManyRedirects => {
return Err(::error::too_many_redirects(self.url.clone()));
return Err(crate::error::too_many_redirects(self.url.clone()));
}
}
}
@@ -903,7 +903,7 @@ fn add_cookie_header(headers: &mut HeaderMap, cookie_store: &cookie::CookieStore
.join("; ");
if !header.is_empty() {
headers.insert(
::header::COOKIE,
crate::header::COOKIE,
HeaderValue::from_bytes(header.as_bytes()).unwrap()
);
}

View File

@@ -32,7 +32,7 @@ use hyper::{HeaderMap};
use hyper::header::{CONTENT_ENCODING, CONTENT_LENGTH, TRANSFER_ENCODING};
use super::{Body, Chunk};
use error;
use crate::error;
const INIT_BUFFER_SIZE: usize = 8192;

View File

@@ -199,7 +199,7 @@ impl Part {
}
/// Tries to set the mime of this part.
pub fn mime_str(self, mime: &str) -> ::Result<Part> {
pub fn mime_str(self, mime: &str) -> crate::Result<Part> {
Ok(self.mime(try_!(mime.parse())))
}

View File

@@ -10,9 +10,9 @@ use super::body::{Body};
use super::client::{Client, Pending};
use super::multipart;
use super::response::Response;
use header::{CONTENT_LENGTH, CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue};
use crate::header::{CONTENT_LENGTH, CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue};
use http::HttpTryFrom;
use {Method, Url};
use crate::{Method, Url};
/// A request which can be executed with `Client::execute()`.
pub struct Request {
@@ -25,7 +25,7 @@ pub struct Request {
/// A builder to construct the properties of a `Request`.
pub struct RequestBuilder {
client: Client,
request: ::Result<Request>,
request: crate::Result<Request>,
}
impl Request {
@@ -94,7 +94,7 @@ impl Request {
}
impl RequestBuilder {
pub(super) fn new(client: Client, request: ::Result<Request>) -> RequestBuilder {
pub(super) fn new(client: Client, request: crate::Result<Request>) -> RequestBuilder {
RequestBuilder {
client,
request,
@@ -113,10 +113,10 @@ impl RequestBuilder {
Ok(key) => {
match <HeaderValue as HttpTryFrom<V>>::try_from(value) {
Ok(value) => { req.headers_mut().append(key, value); }
Err(e) => error = Some(::error::from(e.into())),
Err(e) => error = Some(crate::error::from(e.into())),
}
},
Err(e) => error = Some(::error::from(e.into())),
Err(e) => error = Some(crate::error::from(e.into())),
};
}
if let Some(err) = error {
@@ -128,7 +128,7 @@ impl RequestBuilder {
/// Add a set of Headers to the existing ones on this Request.
///
/// The headers will be merged in to any already set.
pub fn headers(mut self, headers: ::header::HeaderMap) -> RequestBuilder {
pub fn headers(mut self, headers: crate::header::HeaderMap) -> RequestBuilder {
if let Ok(ref mut req) = self.request {
replace_headers(req.headers_mut(), headers);
}
@@ -171,7 +171,7 @@ impl RequestBuilder {
None => format!("{}:", username)
};
let header_value = format!("Basic {}", encode(&auth));
self.header(::header::AUTHORIZATION, &*header_value)
self.header(crate::header::AUTHORIZATION, &*header_value)
}
/// Enable HTTP bearer authentication.
@@ -180,7 +180,7 @@ impl RequestBuilder {
T: fmt::Display,
{
let header_value = format!("Bearer {}", token);
self.header(::header::AUTHORIZATION, &*header_value)
self.header(crate::header::AUTHORIZATION, &*header_value)
}
/// Set the request body.
@@ -264,7 +264,7 @@ impl RequestBuilder {
let serializer = serde_urlencoded::Serializer::new(&mut pairs);
if let Err(err) = query.serialize(serializer) {
error = Some(::error::from(err));
error = Some(crate::error::from(err));
}
}
if let Ok(ref mut req) = self.request {
@@ -290,7 +290,7 @@ impl RequestBuilder {
);
*req.body_mut() = Some(body.into());
},
Err(err) => error = Some(::error::from(err)),
Err(err) => error = Some(crate::error::from(err)),
}
}
if let Some(err) = error {
@@ -316,7 +316,7 @@ impl RequestBuilder {
);
*req.body_mut() = Some(body.into());
},
Err(err) => error = Some(::error::from(err)),
Err(err) => error = Some(crate::error::from(err)),
}
}
if let Some(err) = error {
@@ -327,7 +327,7 @@ impl RequestBuilder {
/// Build a `Request`, which can be inspected, modified and executed with
/// `Client::execute()`.
pub fn build(self) -> ::Result<Request> {
pub fn build(self) -> crate::Result<Request> {
self.request
}
@@ -358,7 +358,7 @@ impl RequestBuilder {
/// rt.block_on(response)
/// # }
/// ```
pub fn send(self) -> impl Future<Item = Response, Error = ::Error> {
pub fn send(self) -> impl Future<Item = Response, Error = crate::Error> {
match self.request {
Ok(req) => self.client.execute_request(req),
Err(err) => Pending::new_err(err),

View File

@@ -18,7 +18,7 @@ use serde_json;
use url::Url;
use cookie;
use crate::cookie;
use super::Decoder;
use super::body::Body;
@@ -139,14 +139,14 @@ impl Response {
}
/// Get the response text
pub fn text(&mut self) -> impl Future<Item = String, Error = ::Error> {
pub fn text(&mut self) -> impl Future<Item = String, Error = crate::Error> {
self.text_with_charset("utf-8")
}
/// Get the response text given a specific encoding
pub fn text_with_charset(&mut self, default_encoding: &str) -> impl Future<Item = String, Error = ::Error> {
pub fn text_with_charset(&mut self, default_encoding: &str) -> impl Future<Item = String, Error = crate::Error> {
let body = mem::replace(&mut self.body, Decoder::empty());
let content_type = self.headers.get(::header::CONTENT_TYPE)
let content_type = self.headers.get(crate::header::CONTENT_TYPE)
.and_then(|value| {
value.to_str().ok()
})
@@ -170,7 +170,7 @@ impl Response {
/// Try to deserialize the response body as JSON using `serde`.
#[inline]
pub fn json<T: DeserializeOwned>(&mut self) -> impl Future<Item = T, Error = ::Error> {
pub fn json<T: DeserializeOwned>(&mut self) -> impl Future<Item = T, Error = crate::Error> {
let body = mem::replace(&mut self.body, Decoder::empty());
Json {
@@ -201,9 +201,9 @@ impl Response {
/// # fn main() {}
/// ```
#[inline]
pub fn error_for_status(self) -> ::Result<Self> {
pub fn error_for_status(self) -> crate::Result<Self> {
if self.status.is_client_error() || self.status.is_server_error() {
Err(::error::status_code(*self.url, self.status))
Err(crate::error::status_code(*self.url, self.status))
} else {
Ok(self)
}
@@ -231,9 +231,9 @@ impl Response {
/// # fn main() {}
/// ```
#[inline]
pub fn error_for_status_ref(&self) -> ::Result<&Self> {
pub fn error_for_status_ref(&self) -> crate::Result<&Self> {
if self.status.is_client_error() || self.status.is_server_error() {
Err(::error::status_code(*self.url.clone(), self.status))
Err(crate::error::status_code(*self.url.clone(), self.status))
} else {
Ok(self)
}
@@ -278,7 +278,7 @@ struct Json<T> {
impl<T: DeserializeOwned> Future for Json<T> {
type Item = T;
type Error = ::Error;
type Error = crate::Error;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
let bytes = try_ready!(self.concat.poll());
let t = try_!(serde_json::from_slice(&bytes));
@@ -301,7 +301,7 @@ struct Text {
impl Future for Text {
type Item = String;
type Error = ::Error;
type Error = crate::Error;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
let bytes = try_ready!(self.concat.poll());
// a block because of borrow checker