From 96a77890ba7d3805f0ae2b8622c48f9861c54814 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 1 Jun 2018 11:31:53 -0700 Subject: [PATCH] do not use with2 --- .travis.yml | 13 +++++++------ Cargo.lock | 18 ++++++++++++++++++ diesel/src/main.rs | 10 ++++++---- juniper/src/main.rs | 4 ++-- rustfmt.toml | 2 +- template_tera/src/main.rs | 4 ++-- 6 files changed, 36 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5cbdd109..2ca5f86d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,12 +14,6 @@ matrix: allow_failures: - rust: nightly -#rust: -# - 1.21.0 -# - stable -# - beta -# - nightly-2018-01-03 - env: global: # - RUSTFLAGS="-C link-dead-code" @@ -40,7 +34,11 @@ before_script: script: - | + cd async_db && cargo check && cd .. + cd async_ex1 && cargo check && cd .. cd basics && cargo check && cd .. + cd cookie-auth && cargo check && cd .. + cd cookie-session && cargo check && cd .. cd diesel && cargo check && cd .. cd hello-world && cargo check && cd .. cd http-proxy && cargo check && cd .. @@ -51,9 +49,12 @@ script: cd r2d2 && cargo check && cd .. cd redis-session && cargo check && cd .. cd state && cargo check && cd .. + cd static_index && cargo check && cd .. + cd template_askama && cargo check && cd .. cd template_tera && cargo check && cd .. cd tls && cargo check && cd .. cd unix-socket && cargo check && cd .. cd web-cors/backend && cargo check && cd ../.. cd websocket && cargo check && cd .. cd websocket-chat && cargo check && cd .. + cd websocket-tcp-chat && cargo check && cd .. diff --git a/Cargo.lock b/Cargo.lock index 8267733c..55face1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -164,6 +164,24 @@ dependencies = [ "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "async_db" +version = "0.1.0" +dependencies = [ + "actix 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-web 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "dotenv 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "r2d2 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "r2d2_sqlite 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "atty" version = "0.2.10" diff --git a/diesel/src/main.rs b/diesel/src/main.rs index 355f31d2..96b7b79a 100644 --- a/diesel/src/main.rs +++ b/diesel/src/main.rs @@ -24,8 +24,8 @@ use actix_web::{ }; use diesel::prelude::*; -use diesel::r2d2::{ConnectionManager, Pool}; -use futures::future::Future; +use diesel::r2d2::ConnectionManager; +use futures::Future; mod db; mod models; @@ -39,7 +39,9 @@ struct AppState { } /// Async request handler -fn index(name: Path, state: State) -> FutureResponse { +fn index( + (name, state): (Path, State), +) -> FutureResponse { // send async `CreateUser` message to a `DbExecutor` state .db @@ -72,7 +74,7 @@ fn main() { App::with_state(AppState{db: addr.clone()}) // enable logger .middleware(middleware::Logger::default()) - .resource("/{name}", |r| r.method(http::Method::GET).with2(index)) + .resource("/{name}", |r| r.method(http::Method::GET).with(index)) }).bind("127.0.0.1:8080") .unwrap() .start(); diff --git a/juniper/src/main.rs b/juniper/src/main.rs index 8147d6d3..6e3bd61a 100644 --- a/juniper/src/main.rs +++ b/juniper/src/main.rs @@ -69,7 +69,7 @@ fn graphiql(_req: HttpRequest) -> Result { } fn graphql( - st: State, data: Json, + (st, data): (State, Json), ) -> FutureResponse { st.executor .send(data.0) @@ -96,7 +96,7 @@ fn main() { App::with_state(AppState{executor: addr.clone()}) // enable logger .middleware(middleware::Logger::default()) - .resource("/graphql", |r| r.method(http::Method::POST).with2(graphql)) + .resource("/graphql", |r| r.method(http::Method::POST).with(graphql)) .resource("/graphiql", |r| r.method(http::Method::GET).h(graphiql)) }).bind("127.0.0.1:8080") .unwrap() diff --git a/rustfmt.toml b/rustfmt.toml index 6db67ed2..4fff285e 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,5 +1,5 @@ max_width = 89 reorder_imports = true -wrap_comments = true +#wrap_comments = true fn_args_density = "Compressed" #use_small_heuristics = false diff --git a/template_tera/src/main.rs b/template_tera/src/main.rs index af8bcae7..e7e2c780 100644 --- a/template_tera/src/main.rs +++ b/template_tera/src/main.rs @@ -15,7 +15,7 @@ struct AppState { } fn index( - state: State, query: Query>, + (state, query): (State, Query>), ) -> Result { let s = if let Some(name) = query.get("name") { // <- submitted form @@ -47,7 +47,7 @@ fn main() { App::with_state(AppState{template: tera}) // enable logger .middleware(middleware::Logger::default()) - .resource("/", |r| r.method(http::Method::GET).with2(index)) + .resource("/", |r| r.method(http::Method::GET).with(index)) }).bind("127.0.0.1:8080") .unwrap() .start();