fix: mark unsafety of std::env::set_var

and document the function.
This commit is contained in:
Gwen Lg
2026-01-27 15:32:12 +01:00
parent 5c8a31708e
commit 473b66ca5b
2 changed files with 10 additions and 2 deletions
+4 -1
View File
@@ -388,9 +388,12 @@ impl Filter {
}
}
/// # Safety
///
/// initialize `RUST_LOG` env var before start tokio runtime to limit multithread problem with `std::env::set_var` which is unsafe
fn main() -> Result<(), Error> {
if std::env::var("RUST_LOG").is_err() {
std::env::set_var("RUST_LOG", "warn")
unsafe { std::env::set_var("RUST_LOG", "warn") };
}
tracing_subscriber::fmt()