Fix benchmark compilation.

This commit is contained in:
messense 2018-08-12 21:10:11 +08:00 committed by Sergio Benitez
parent ec130f96ee
commit 589743579a
3 changed files with 14 additions and 15 deletions

View File

@ -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 {

View File

@ -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])
}

View File

@ -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) {