Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
subscriber: fix empty string handling in
EnvFilter::builder().parse
(…
…#2052) ## Motivation See issue #2046. When using calling [`Builder::parse`] or [`Builder::parse_lossy`] with an empty string an error is produced. This happens for example when `EnvFilter::from_default_env()` is called, but the `RUST_LOG` variable is unset. This regression was introduced by #2035. ## Solution Filter any empty directives. This allows the whole string to be empty, as well as leading and trailing commas. A unit test was added for [`Builder::parse`], but not [`Builder::parse_lossy`] because it (per definition) doesn't produce any side effects visible from tests when erroring. Fixes #2046 [`Builder::parse`]: https://github.com/tokio-rs/tracing/blob/cade7e311848227348c9b3062e4a33db827a0390/tracing-subscriber/src/filter/env/builder.rs#L151= [`Builder::parse_lossy`]: https://github.com/tokio-rs/tracing/blob/cade7e311848227348c9b3062e4a33db827a0390/tracing-subscriber/src/filter/env/builder.rs#L135=
- Loading branch information