The tracing macros such as info!, debug! or trace! from the log crate are not compiled away in release mode, because tracing can be enabled at runtime (via env_logger).
In principle, tracing can be disabled at compile time by enabling some features in the log crate (https://docs.rs/log/0.4.8/log/#compile-time-filters). However, enabling a feature for a crate affects all code that also depend on this crate within a build. So if a binary depends on lzma-rs and wants to log something else, then it cannot optimize away logging in lzma-rs via log's features.
A better solution would be to have a feature in lzma-rs to enable logging (as it is mostly useful for developing lzma-rs). By default, this logging feature will be off so that users of lzma-rs see a performance improvement in general.
The tracing macros such as
info!
,debug!
ortrace!
from the log crate are not compiled away in release mode, because tracing can be enabled at runtime (via env_logger).In principle, tracing can be disabled at compile time by enabling some features in the
log
crate (https://docs.rs/log/0.4.8/log/#compile-time-filters). However, enabling a feature for a crate affects all code that also depend on this crate within a build. So if a binary depends onlzma-rs
and wants to log something else, then it cannot optimize away logging inlzma-rs
vialog
's features.A better solution would be to have a feature in
lzma-rs
to enable logging (as it is mostly useful for developinglzma-rs
). By default, this logging feature will be off so that users oflzma-rs
see a performance improvement in general.