Description
There are 4 unnecessary unsafe blocks in crates/comenqd/src/config.rs that wrap calls to std::env::set_var and std::env::remove_var. These functions are safe in Rust and do not require unsafe blocks.
Problem
The unsafe blocks violate the coding guidelines which state "Avoid unsafe unless absolutely necessary."
Locations
- Line 126:
unsafe { std::env::set_var(key, val); }
- Line 139:
unsafe { std::env::set_var(&self.key, v) }
- Line 140:
unsafe { std::env::remove_var(&self.key) }
- Line 146:
unsafe { std::env::remove_var(key); }
Solution
Remove all unsafe blocks wrapping these environment variable function calls since they are safe functions.
References
Description
There are 4 unnecessary unsafe blocks in
crates/comenqd/src/config.rsthat wrap calls tostd::env::set_varandstd::env::remove_var. These functions are safe in Rust and do not require unsafe blocks.Problem
The unsafe blocks violate the coding guidelines which state "Avoid
unsafeunless absolutely necessary."Locations
unsafe { std::env::set_var(key, val); }unsafe { std::env::set_var(&self.key, v) }unsafe { std::env::remove_var(&self.key) }unsafe { std::env::remove_var(key); }Solution
Remove all unsafe blocks wrapping these environment variable function calls since they are safe functions.
References