From 589743579ac1e5168b018181ffcbdb6e5ac1ee7c Mon Sep 17 00:00:00 2001 From: messense Date: Sun, 12 Aug 2018 21:10:11 +0800 Subject: [PATCH] Fix benchmark compilation. --- core/lib/benches/format-routing.rs | 8 ++++---- core/lib/benches/ranked-routing.rs | 8 ++++---- core/lib/benches/simple-routing.rs | 13 ++++++------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/core/lib/benches/format-routing.rs b/core/lib/benches/format-routing.rs index 41b068d1..8b943a88 100644 --- a/core/lib/benches/format-routing.rs +++ b/core/lib/benches/format-routing.rs @@ -1,9 +1,9 @@ -#![feature(test, plugin)] +#![feature(test, plugin, decl_macro)] #![plugin(rocket_codegen)] extern crate rocket; -use rocket::config::{Environment, Config}; +use rocket::config::{Environment, Config, LoggingLevel}; #[get("/", format = "application/json")] fn get() -> &'static str { "get" } @@ -12,8 +12,8 @@ fn get() -> &'static str { "get" } fn post() -> &'static str { "post" } fn rocket() -> rocket::Rocket { - let config = Config::new(Environment::Production).unwrap(); - rocket::custom(config, false).mount("/", routes![get, post]) + let config = Config::build(Environment::Production).log_level(LoggingLevel::Off); + rocket::custom(config.unwrap()).mount("/", routes![get, post]) } mod benches { diff --git a/core/lib/benches/ranked-routing.rs b/core/lib/benches/ranked-routing.rs index d5725861..d4290430 100644 --- a/core/lib/benches/ranked-routing.rs +++ b/core/lib/benches/ranked-routing.rs @@ -1,9 +1,9 @@ -#![feature(test, plugin)] +#![feature(test, plugin, decl_macro)] #![plugin(rocket_codegen)] extern crate rocket; -use rocket::config::{Environment, Config}; +use rocket::config::{Environment, Config, LoggingLevel}; #[get("/", format = "application/json")] fn get() -> &'static str { "json" } @@ -24,8 +24,8 @@ fn post2() -> &'static str { "html" } fn post3() -> &'static str { "plain" } fn rocket() -> rocket::Rocket { - let config = Config::new(Environment::Production).unwrap(); - rocket::custom(config, false) + let config = Config::build(Environment::Production).log_level(LoggingLevel::Off); + rocket::custom(config.unwrap()) .mount("/", routes![get, get2, get3]) .mount("/", routes![post, post2, post3]) } diff --git a/core/lib/benches/simple-routing.rs b/core/lib/benches/simple-routing.rs index 6cef77f3..e6b3cdfb 100644 --- a/core/lib/benches/simple-routing.rs +++ b/core/lib/benches/simple-routing.rs @@ -1,11 +1,11 @@ -#![feature(test, plugin)] +#![feature(test, plugin, decl_macro)] #![plugin(rocket_codegen)] // #![feature(alloc_system)] // extern crate alloc_system; extern crate rocket; -use rocket::config::{Environment, Config}; +use rocket::config::{Environment, Config, LoggingLevel}; use rocket::http::RawStr; #[get("/")] @@ -33,13 +33,13 @@ fn index_c() -> &'static str { "index" } fn index_dyn_a(a: &RawStr) -> &'static str { "index" } fn hello_world_rocket() -> rocket::Rocket { - let config = Config::new(Environment::Production).unwrap(); - rocket::custom(config, false).mount("/", routes![hello_world]) + let config = Config::build(Environment::Production).log_level(LoggingLevel::Off); + rocket::custom(config.unwrap()).mount("/", routes![hello_world]) } fn rocket() -> rocket::Rocket { - let config = Config::new(Environment::Production).unwrap(); - rocket::custom(config, false) + let config = Config::build(Environment::Production).log_level(LoggingLevel::Off); + rocket::custom(config.unwrap()) .mount("/", routes![get_index, put_index, post_index, index_a, index_b, index_c, index_dyn_a]) } @@ -50,7 +50,6 @@ mod benches { use super::{hello_world_rocket, rocket}; use self::test::Bencher; use rocket::local::Client; - use rocket::http::Method::*; #[bench] fn bench_hello_world(b: &mut Bencher) {