Skip to content

Commit f5fa9f1

Browse files
cat æsclingbeeender
authored andcommitted
Wrap env::remove_var calls in unsafe blocks
env::remove_var is newly marked unsafe in the 2024 edition due to its inherent unreliability in multithreaded contexts. This code is single-threaded so there should be no problem. See https://doc.rust-lang.org/edition-guide/rust-2024/newly-unsafe-functions.html#stdenvset_var-remove_var
1 parent 1f72b1a commit f5fa9f1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ fn prepare_env() {}
2222
fn prepare_env() {
2323
// When starting from iTerm, these env vars could cause some display issues.
2424
log::debug!("unset $TERM_PROGRAM");
25-
env::remove_var("TERM_PROGRAM");
25+
unsafe { env::remove_var("TERM_PROGRAM") };
2626
log::debug!("unset $TERM_PROGRAM_VERSION");
27-
env::remove_var("TERM_PROGRAM_VERSION");
27+
unsafe { env::remove_var("TERM_PROGRAM_VERSION") };
2828
}
2929

3030
fn check_nvim(vim_exe_path: &str) {

0 commit comments

Comments
 (0)