#12228 demonstrates a good step toward removing unnecessary unsafe usage and global environment mutation in tests. This change highlights a broader pattern in the codebase: extensive use of std::env::set_var and std::env::remove_var, which is both unsafe in practice (even if not marked unsafe) and makes code harder to reason about.
We should generalize this approach across the codebase, maybe by using Command::env.
#12228 demonstrates a good step toward removing unnecessary unsafe usage and global environment mutation in tests. This change highlights a broader pattern in the codebase: extensive use of
std::env::set_varandstd::env::remove_var, which is both unsafe in practice (even if not marked unsafe) and makes code harder to reason about.We should generalize this approach across the codebase, maybe by using
Command::env.