Skip to content

Commit d06b89d

Browse files
committed
Clarify rules loop in locations_under_program_files
This renames `pf` to `program_files_dir` and refactors how it is set so that its meaning and type are immediately clear.
1 parent 1fa24cd commit d06b89d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

gix-path/src/env/git/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,15 @@ where
6161

6262
let mut locations = vec![];
6363

64-
for (name, suffixes) in rules {
65-
let Some(pf) = var_os_func(name) else { continue };
66-
let pf = Path::new(&pf);
67-
if pf.is_relative() {
64+
for (varname, suffixes) in rules {
65+
let Some(program_files_dir) = var_os_func(varname).map(PathBuf::from) else { continue };
66+
if program_files_dir.is_relative() {
6867
// This shouldn't happen, but if it does then don't use the path. This is mainly in
6968
// case we are accidentally invoked with the environment variable set but empty.
7069
continue;
7170
}
7271
for suffix in suffixes {
73-
let location = pf.join(suffix);
72+
let location = program_files_dir.join(suffix);
7473
if !locations.contains(&location) {
7574
locations.push(location);
7675
}

0 commit comments

Comments
 (0)