minor: improve readability

It's important that module interface doesn't depend on features. Better
hide features in bodies.
This commit is contained in:
Aleksey Kladov 2021-09-11 18:42:38 +03:00
parent 07fb5db3dc
commit e5b813b566

View file

@ -19,13 +19,11 @@ pub fn timeit(label: &'static str) -> impl Drop {
}
/// Prints backtrace to stderr, useful for debugging.
#[cfg(feature = "backtrace")]
pub fn print_backtrace() {
let bt = backtrace::Backtrace::new();
eprintln!("{:?}", bt);
}
#[cfg(not(feature = "backtrace"))]
pub fn print_backtrace() {
#[cfg(feature = "backtrace")]
eprintln!("{:?}", backtrace::Backtrace::new());
#[cfg(not(feature = "backtrace"))]
eprintln!(
r#"Enable the backtrace feature.
Uncomment `default = [ "backtrace" ]` in `crates/stdx/Cargo.toml`.