Fix existing benchmarks
The #[cfg(bench)] attribute does not exist and is always false. Lets define a feature "bench" which can be used to enable benchmarks when building with nightly.
This commit is contained in:
parent
d9929a60b4
commit
db8784f97c
|
@ -29,6 +29,7 @@ alloc = []
|
|||
std = []
|
||||
clock = ["time", "std"]
|
||||
wasmbind = ["wasm-bindgen", "js-sys"]
|
||||
bench = ["std"]
|
||||
|
||||
[dependencies]
|
||||
time = { version = "0.1.39", optional = true }
|
||||
|
|
|
@ -383,7 +383,7 @@
|
|||
|
||||
#![doc(html_root_url = "https://docs.rs/chrono/latest/")]
|
||||
|
||||
#![cfg_attr(bench, feature(test))] // lib stability features as per RFC #507
|
||||
#![cfg_attr(feature = "bench", feature(test))] // lib stability features as per RFC #507
|
||||
#![deny(missing_docs)]
|
||||
#![deny(missing_debug_implementations)]
|
||||
|
||||
|
@ -427,6 +427,8 @@ extern crate doc_comment;
|
|||
extern crate wasm_bindgen;
|
||||
#[cfg(all(target_arch = "wasm32", feature="wasmbind"))]
|
||||
extern crate js_sys;
|
||||
#[cfg(feature = "bench")]
|
||||
extern crate test;
|
||||
|
||||
#[cfg(test)]
|
||||
doctest!("../README.md");
|
||||
|
|
|
@ -470,7 +470,6 @@ impl fmt::Debug for Mdf {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[cfg(test)] extern crate num_iter;
|
||||
#[cfg(bench)] extern crate test;
|
||||
|
||||
use Weekday;
|
||||
use super::{Of, Mdf};
|
||||
|
@ -517,7 +516,7 @@ mod tests {
|
|||
assert_eq!(GF.nisoweeks(), 52);
|
||||
}
|
||||
|
||||
#[cfg(bench)]
|
||||
#[cfg(feature = "bench")]
|
||||
#[bench]
|
||||
fn bench_year_flags_from_year(bh: &mut test::Bencher) {
|
||||
bh.iter(|| {
|
||||
|
|
Loading…
Reference in New Issue