Skip to content

Commit

Permalink
Update trait object syntax to use 'dyn'
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Jun 3, 2019
1 parent 1d26d7b commit 964d87c
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
extern crate reqwest;
extern crate env_logger;

fn main() -> Result<(), Box<std::error::Error>> {
fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::init();

println!("GET https://www.rust-lang.org");
Expand Down
6 changes: 3 additions & 3 deletions src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl Body {


enum Kind {
Reader(Box<Read + Send>, Option<u64>),
Reader(Box<dyn Read + Send>, Option<u64>),
Bytes(Bytes),
}

Expand Down Expand Up @@ -197,7 +197,7 @@ impl<'a> fmt::Debug for DebugLength<'a> {
}

pub(crate) enum Reader {
Reader(Box<Read + Send>),
Reader(Box<dyn Read + Send>),
Bytes(Cursor<Bytes>),
}

Expand All @@ -211,7 +211,7 @@ impl Read for Reader {
}

pub(crate) struct Sender {
body: (Box<Read + Send>, Option<u64>),
body: (Box<dyn Read + Send>, Option<u64>),
tx: hyper::body::Sender,
}

Expand Down
2 changes: 1 addition & 1 deletion src/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ pub(crate) trait AsyncConn: AsyncRead + AsyncWrite {}
impl<T: AsyncRead + AsyncWrite> AsyncConn for T {}
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")]
fn tunnel<T>(conn: T, host: String, port: u16, auth: Option<::http::header::HeaderValue>) -> Tunnel<T> {
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ mod tests {
"root"
}
}
fn cause(&self) -> Option<&StdError> {
fn cause(&self) -> Option<&dyn StdError> {
if let Some(ref e) = self.0 {
Some(e)
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! ```
//! use reqwest::multipart;
//!
//! # fn run() -> Result<(), Box<::std::error::Error>> {
//! # fn run() -> Result<(), Box<dyn std::error::Error>> {
//! let form = multipart::Form::new()
//! // Adding just a simple text field...
//! .text("username", "seanmonstar")
Expand Down Expand Up @@ -282,7 +282,7 @@ impl PartProps for Part {

pub(crate) struct Reader {
form: Form,
active_reader: Option<Box<Read + Send>>,
active_reader: Option<Box<dyn Read + Send>>,
}

impl fmt::Debug for Reader {
Expand Down
2 changes: 1 addition & 1 deletion src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl Intercept {
struct Custom {
// This auth only applies if the returned ProxyScheme doesn't have an auth...
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 {
Expand Down
2 changes: 1 addition & 1 deletion src/redirect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl<'a> RedirectAttempt<'a> {
}

enum Policy {
Custom(Box<Fn(RedirectAttempt) -> RedirectAction + Send + Sync + 'static>),
Custom(Box<dyn Fn(RedirectAttempt) -> RedirectAction + Send + Sync + 'static>),
Limit(usize),
None,
}
Expand Down

0 comments on commit 964d87c

Please sign in to comment.