Skip to content

Commit

Permalink
bench: move bench behind cfg flag rather than Cargo feature
Browse files Browse the repository at this point in the history
  • Loading branch information
apoelstra committed Jun 15, 2023
1 parent b39aa2a commit a7b49cc
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ edition = "2018"
compiler = []
trace = []

unstable = []
serde = ["actual-serde", "bitcoin/serde", "elements/serde"]
rand = ["bitcoin/rand"]
base64 = ["bitcoin/base64"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Enabling the `no-std` feature does not disable `std`. To disable the `std` featu

## Benchmarking

To run the benchmarks run `RUSTFLAGS=--cfg=bench cargo +nightly bench`.
To run the benchmarks run `RUSTFLAGS=--cfg=miniscript_bench cargo +nightly bench --all-features`.

## Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features on **Rust 1.48.0**.
Expand Down
2 changes: 1 addition & 1 deletion contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fi
# Bench if told to (this only works with the nightly toolchain)
if [ "$DO_BENCH" = true ]
then
RUSTFLAGS=--cfg=bench cargo bench --features="unstable compiler"
RUSTFLAGS=--cfg=miniscript_bench cargo bench --features="compiler"
fi

# Build the docs if told to (this only works with the nightly toolchain)
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
//!
//!

#![cfg_attr(all(test, feature = "unstable"), feature(test))]
#![cfg_attr(miniscript_bench, feature(test))]
// Coding conventions
#![allow(bare_trait_objects)]
#![deny(non_camel_case_types)]
Expand All @@ -109,7 +109,7 @@ compile_error!(
#[cfg(feature = "serde")]
pub use actual_serde as serde;
pub use {bitcoin, elements};
#[cfg(all(test, feature = "unstable"))]
#[cfg(miniscript_bench)]
extern crate test;

// Miniscript imports
Expand Down
2 changes: 1 addition & 1 deletion src/policy/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,7 @@ mod tests {
}
}

#[cfg(all(test, feature = "unstable"))]
#[cfg(miniscript_bench)]
mod benches {
use std::str::FromStr;

Expand Down
2 changes: 1 addition & 1 deletion src/policy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ mod tests {
}
}

#[cfg(all(test, feature = "compiler", feature = "unstable"))]
#[cfg(all(miniscript_bench, feature = "compiler"))]
mod benches {
use core::str::FromStr;

Expand Down

0 comments on commit a7b49cc

Please sign in to comment.