#dbg #builds #fork #effect #macro #std #sensible

sensible-dbg

Fork of the std::dbg macro that has no effect on release builds

2 releases

0.1.1 Jan 18, 2019
0.1.0 Jan 18, 2019

#1688 in Rust patterns


Used in entropy-rs

MIT license

3KB

sensible-dbg

If you read the discussion on std's new dbg! macro, you'll find that there are good reasons why it shouldn't affect release builds. As a silent protest against the decision, I made my own version.

Usage

use sensible_dbg::dbg;

fn factorial(n: u32) -> u32 {
    if dbg!(n <= 1) {
        dbg!(1)
    } else {
        dbg!(n * factorial(n - 1))
    }
}

No runtime deps