Skip to content

Add a macro for print in debug mode only #2267

@3442853561

Description

@3442853561

I not sure is RFC #2173 include this issue, or not.

macro_rules! debug {
    ($($arg:tt)*) => { 
        if cfg!(debug_assertions) {
            print!($($arg)*);
        }
    };
}

fn main() {
    debug!("test");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-libs-apiRelevant to the library API team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions