c2pa-rs icon indicating copy to clipboard operation
c2pa-rs copied to clipboard

set_var unsafe errors in the CLI code

Open puhley opened this issue 8 months ago • 1 comments

In /cli/src/main.rs on line 543, env::set_var is used:

std::env::set_var("RUST_LOG", "error");

According to Rust documentation (https://doc.rust-lang.org/std/env/fn.set_var.html), the set_var function is considered unsafe and it throws a compiler warning in newer compiler versions.

| std::env::set_var("RUST_LOG", "error"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function

This command should give the same result without the unsafe function call:

env_logger::Builder::from_env(Env::default().default_filter_or("error")).init();

puhley avatar Apr 04 '25 02:04 puhley