ruma-events: Feature gate criterion to avoid compilation in CI#111
Merged
jplatte merged 4 commits intoruma:masterfrom Jul 6, 2020
Merged
ruma-events: Feature gate criterion to avoid compilation in CI#111jplatte merged 4 commits intoruma:masterfrom
jplatte merged 4 commits intoruma:masterfrom
Conversation
jplatte
reviewed
Jul 6, 2020
| // This makes the compiler only spit out the `compile_error!` when | ||
| // `cargo bench` is run without the `criterion_bench` feature. | ||
| #[cfg(not(feature = "criterion_bench"))] | ||
| fn main() {} |
Member
There was a problem hiding this comment.
To have one #[cfg] less, we could move the compile_error! into the alternative main. We could also move all of the actual criterion stuff into a separate #[cfg]ed module, though I'm not sure that's worth it (this would require moving benches/event_deserialize.rs to benches/event_deserialize/main.rs)
Member
|
Looks good, my only concern is the IDE thing you noted in #106. |
Member
Author
|
This works and doesn't mess up the IDE #[cfg(not(feature = "criterion_bench"))]
fn main() {
// To run the benchmarks the "criterion_bench" feature must be enabled.
// `cargo bench --features criterion_bench --bench <name of the bench>`
panic!("Enable the criterion_bench feature to run benchmarks");
}gives A |
Member
|
Yeah, let's just |
jplatte
reviewed
Jul 6, 2020
jplatte
reviewed
Jul 6, 2020
Comment on lines
+35
to
+36
| [features] | ||
| default = [] |
Member
There was a problem hiding this comment.
I'm relatively certain this is unnecessary.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
edit(jplatte): fixes #106