From da33e3d22540a1cc822e95177b72cd905c1a66de Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Tue, 9 Jul 2019 01:03:51 -0300 Subject: [PATCH] Add async_closure feature gate where needed --- .travis.yml | 2 +- examples/cors.rs | 2 +- examples/default_headers.rs | 2 +- examples/hello.rs | 2 +- examples/hello_envlog.rs | 2 +- examples/hello_logrs.rs | 2 +- examples/messages.rs | 4 ++-- examples/runtime.rs | 2 +- src/app.rs | 6 +++--- src/lib.rs | 2 +- tests/wildcard.rs | 2 +- tide-cors/src/lib.rs | 4 ++-- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8e56b7e2f..3ce7396a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: rust -rust: nightly-2019-06-02 +rust: nightly-2019-07-08 cache: cargo before_script: diff --git a/examples/cors.rs b/examples/cors.rs index c0c93ddbc..9cabb8efd 100644 --- a/examples/cors.rs +++ b/examples/cors.rs @@ -1,4 +1,4 @@ -#![feature(async_await)] +#![feature(async_await, async_closure)] use http::header::HeaderValue; use tide::middleware::CorsMiddleware; diff --git a/examples/default_headers.rs b/examples/default_headers.rs index 70f4a8d54..8b54e6af3 100644 --- a/examples/default_headers.rs +++ b/examples/default_headers.rs @@ -1,4 +1,4 @@ -#![feature(async_await)] +#![feature(async_await, async_closure)] use tide::middleware::DefaultHeaders; diff --git a/examples/hello.rs b/examples/hello.rs index edcf106e2..2528188ba 100644 --- a/examples/hello.rs +++ b/examples/hello.rs @@ -1,4 +1,4 @@ -#![feature(async_await)] +#![feature(async_await, async_closure)] fn main() { let mut app = tide::App::new(); app.at("/").get(async move |_| "Hello, world!"); diff --git a/examples/hello_envlog.rs b/examples/hello_envlog.rs index d57a5a4bd..df60bf10b 100644 --- a/examples/hello_envlog.rs +++ b/examples/hello_envlog.rs @@ -1,4 +1,4 @@ -#![feature(async_await)] +#![feature(async_await, async_closure)] fn main() { env_logger::from_env(env_logger::Env::default().default_filter_or("info")).init(); let mut app = tide::App::new(); diff --git a/examples/hello_logrs.rs b/examples/hello_logrs.rs index d32f2696e..c21f98627 100644 --- a/examples/hello_logrs.rs +++ b/examples/hello_logrs.rs @@ -1,4 +1,4 @@ -#![feature(async_await)] +#![feature(async_await, async_closure)] fn main() { use log::LevelFilter; use log4rs::append::console::ConsoleAppender; diff --git a/examples/messages.rs b/examples/messages.rs index 023528c89..823ff0631 100644 --- a/examples/messages.rs +++ b/examples/messages.rs @@ -51,7 +51,7 @@ async fn set_message(mut cx: Context) -> EndpointResult<()> { if cx.state().set(id, msg) { Ok(()) } else { - Err(StatusCode::NOT_FOUND)? + Err(StatusCode::NOT_FOUND.into()) } } @@ -60,7 +60,7 @@ async fn get_message(cx: Context) -> EndpointResult { if let Some(msg) = cx.state().get(id) { Ok(response::json(msg)) } else { - Err(StatusCode::NOT_FOUND)? + Err(StatusCode::NOT_FOUND.into()) } } diff --git a/examples/runtime.rs b/examples/runtime.rs index e1accc5fd..feb35958e 100644 --- a/examples/runtime.rs +++ b/examples/runtime.rs @@ -1,4 +1,4 @@ -#![feature(async_await)] +#![feature(async_await, async_closure)] /// An example of how to run a Tide service on top of `runtime`, this also shows the pieces /// necessary if you wish to run a service on some other executor/IO source. diff --git a/src/app.rs b/src/app.rs index 03f1c5f1a..8ac66d818 100644 --- a/src/app.rs +++ b/src/app.rs @@ -30,7 +30,7 @@ use crate::{ /// on `127.0.0.1:8000` with: /// /// ```rust, no_run -/// #![feature(async_await)] +/// #![feature(async_await, async_closure)] /// /// let mut app = tide::App::new(); /// app.at("/hello").get(async move |_| "Hello, world!"); @@ -45,7 +45,7 @@ use crate::{ /// segments as parameters to endpoints: /// /// ```rust, no_run -/// #![feature(async_await)] +/// #![feature(async_await, async_closure)] /// /// use tide::error::ResultExt; /// @@ -166,7 +166,7 @@ impl App { /// respective endpoint of the selected resource. Example: /// /// ```rust,no_run - /// # #![feature(async_await)] + /// # #![feature(async_await, async_closure)] /// # let mut app = tide::App::new(); /// app.at("/").get(async move |_| "Hello, world!"); /// ``` diff --git a/src/lib.rs b/src/lib.rs index 894515225..eceffdc04 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ #![cfg_attr(any(feature = "nightly", test), feature(external_doc))] #![cfg_attr(feature = "nightly", doc(include = "../README.md"))] -#![feature(async_await, existential_type)] +#![feature(async_await, async_closure, existential_type)] #![warn( nonstandard_style, rust_2018_idioms, diff --git a/tests/wildcard.rs b/tests/wildcard.rs index 01c364620..d99576de3 100644 --- a/tests/wildcard.rs +++ b/tests/wildcard.rs @@ -1,4 +1,4 @@ -#![feature(async_await)] +#![feature(async_await, async_closure)] use futures::executor::block_on; use http_service::Body; diff --git a/tide-cors/src/lib.rs b/tide-cors/src/lib.rs index 9772cbe16..92fe073c4 100644 --- a/tide-cors/src/lib.rs +++ b/tide-cors/src/lib.rs @@ -3,7 +3,7 @@ //! ## Examples //! //! ```rust,no_run -//! #![feature(async_await)] +//! #![feature(async_await, async_closure)] //! //! use http::header::HeaderValue; //! use tide_cors::CorsMiddleware; @@ -30,7 +30,7 @@ //! //! You will probably get a browser alert when running without cors middleware. -#![feature(async_await)] +#![feature(async_await, async_closure)] #![warn( nonstandard_style, rust_2018_idioms,