I use #[cfg(debug_assertions)] to have some function available only in release mode.
To avoid warning when I am in dev mode, I wanted to put this macro just before my constHI.
But this does not effect...
How can we do the same for const to avoid warning at compile time please ?
#[cfg(debug_assertions)]
const HI : &str = "Hi";
#[cfg(debug_assertions)]
pub my_fn() {
let hi = HI;
}
#[cfg(not(debug_assertions))]
pub my_fn() {
println!("Here");
}
The error message tells you how to fix it, although you have to type it yourself since the playground gets the location wrong if you click the suggestion in the output.
The playground also compiles the file as lib.rs when you use "Test" so it doesn't consider main to be using things. I made it pub here to fix that. This isn't an issue outside of the playground.