Determine if app is being debugged

How can I know if the current crate is being compiled through cargo run? I tried this:

fn main() {
    #[cfg(debug)]
    {
        println!("Hi!");
    }
}

It doesn't do anything in the playground.

fn main() {
    #[cfg(debug_assertions)]
    {
        println!("Hi!");
    }
}
1 Like

Thanks... I should have searched this, thought I'd not find it.

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.