Compile-time "if dev dependencies are included"?

How to spell that in Rust?

I tried

#[cfg(debug_assertions)]
pub use x;

But seems it does not work as I expect.

#[cfg(test)]

At least, that's when I'm usually interested in dev dependencies. If there are other config attributes that would be appropriate I don't know them.

2 Likes

There's no way to do this exactly. You can use #[cfg(test)] for when unit tests are being compiled, or #[cfg(doc)] for when documentation is being compiled.

2 Likes

Thank you.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.