Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot compile this crate #66

Closed
petar-dambovaliev opened this issue May 16, 2021 · 1 comment · Fixed by #68
Closed

cannot compile this crate #66

petar-dambovaliev opened this issue May 16, 2021 · 1 comment · Fixed by #68

Comments

@petar-dambovaliev
Copy link

If it can't compile without the flamegraph feature, why is it optional?

pub enum Output<'a> {
    #[cfg(feature = "flamegraph")]
    Flamegraph(Option<FlamegraphOptions<'a>>),

    #[cfg(feature = "protobuf")]
    Protobuf,
}
 |
17 | pub enum Output<'a> {
   |                 ^^ unused parameter
   |
@YangKeao
Copy link
Member

Oh, sorry! It seems that this problem only occurs when criterion feature is enabled without flamegraph. I will try to fix it right now! The problem locates at:

pub enum Output<'a> {
    #[cfg(feature = "flamegraph")]
    Flamegraph(Option<FlamegraphOptions<'a>>),

    #[cfg(feature = "protobuf")]
    Protobuf,
}

When flamegraph is not enabled, the 'a is an unused parameter. I don't know what's the best practice to fix this problem 🤦‍♂️ . Adding a PhantomData option for this enum is a little wired (or needs exhaustive_patterns).

Maybe writing different enum definitions for different conditions is the best choice, though ugly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants