Update trait object syntax to use 'dyn'

This commit is contained in:
Sean McArthur
2019-06-03 13:14:33 -07:00
parent 1d26d7b472
commit 964d87ce57
7 changed files with 10 additions and 10 deletions

View File

@@ -5,7 +5,7 @@
extern crate reqwest; extern crate reqwest;
extern crate env_logger; extern crate env_logger;
fn main() -> Result<(), Box<std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::init(); env_logger::init();
println!("GET https://www.rust-lang.org"); println!("GET https://www.rust-lang.org");

View File

@@ -118,7 +118,7 @@ impl Body {
enum Kind { enum Kind {
Reader(Box<Read + Send>, Option<u64>), Reader(Box<dyn Read + Send>, Option<u64>),
Bytes(Bytes), Bytes(Bytes),
} }
@@ -197,7 +197,7 @@ impl<'a> fmt::Debug for DebugLength<'a> {
} }
pub(crate) enum Reader { pub(crate) enum Reader {
Reader(Box<Read + Send>), Reader(Box<dyn Read + Send>),
Bytes(Cursor<Bytes>), Bytes(Cursor<Bytes>),
} }
@@ -211,7 +211,7 @@ impl Read for Reader {
} }
pub(crate) struct Sender { pub(crate) struct Sender {
body: (Box<Read + Send>, Option<u64>), body: (Box<dyn Read + Send>, Option<u64>),
tx: hyper::body::Sender, tx: hyper::body::Sender,
} }

View File

@@ -385,7 +385,7 @@ pub(crate) trait AsyncConn: AsyncRead + AsyncWrite {}
impl<T: AsyncRead + AsyncWrite> AsyncConn for T {} impl<T: AsyncRead + AsyncWrite> AsyncConn for T {}
pub(crate) type Conn = Box<dyn AsyncConn + Send + Sync + 'static>; pub(crate) type Conn = Box<dyn AsyncConn + Send + Sync + 'static>;
pub(crate) type Connecting = Box<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> {

View File

@@ -626,7 +626,7 @@ mod tests {
"root" "root"
} }
} }
fn cause(&self) -> Option<&StdError> { fn cause(&self) -> Option<&dyn StdError> {
if let Some(ref e) = self.0 { if let Some(ref e) = self.0 {
Some(e) Some(e)
} else { } else {

View File

@@ -9,7 +9,7 @@
//! ``` //! ```
//! use reqwest::multipart; //! use reqwest::multipart;
//! //!
//! # fn run() -> Result<(), Box<::std::error::Error>> { //! # fn run() -> Result<(), Box<dyn std::error::Error>> {
//! let form = multipart::Form::new() //! let form = multipart::Form::new()
//! // Adding just a simple text field... //! // Adding just a simple text field...
//! .text("username", "seanmonstar") //! .text("username", "seanmonstar")
@@ -282,7 +282,7 @@ impl PartProps for Part {
pub(crate) struct Reader { pub(crate) struct Reader {
form: Form, form: Form,
active_reader: Option<Box<Read + Send>>, active_reader: Option<Box<dyn Read + Send>>,
} }
impl fmt::Debug for Reader { impl fmt::Debug for Reader {

View File

@@ -379,7 +379,7 @@ impl Intercept {
struct Custom { struct Custom {
// This auth only applies if the returned ProxyScheme doesn't have an auth... // This auth only applies if the returned ProxyScheme doesn't have an auth...
auth: Option<HeaderValue>, auth: Option<HeaderValue>,
func: Arc<Fn(&Url) -> Option<::Result<ProxyScheme>> + Send + Sync + 'static>, func: Arc<dyn Fn(&Url) -> Option<::Result<ProxyScheme>> + Send + Sync + 'static>,
} }
impl Custom { impl Custom {

View File

@@ -214,7 +214,7 @@ impl<'a> RedirectAttempt<'a> {
} }
enum Policy { enum Policy {
Custom(Box<Fn(RedirectAttempt) -> RedirectAction + Send + Sync + 'static>), Custom(Box<dyn Fn(RedirectAttempt) -> RedirectAction + Send + Sync + 'static>),
Limit(usize), Limit(usize),
None, None,
} }