Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: move parent_dir outside of loop
  • Loading branch information
RobinMalfait committed Oct 28, 2024
commit 2e3d032887f1c06e7fe67a436eb04c858ff8606c
15 changes: 7 additions & 8 deletions crates/oxide/tests/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,16 @@ mod scanner {
));
}

let parent_dir = format!(
"{}{}",
fs::canonicalize(&base).unwrap().display(),
path::MAIN_SEPARATOR
);

paths = paths
.into_iter()
.map(|x| {
let parent_dir = format!(
"{}{}",
fs::canonicalize(&base).unwrap().display(),
path::MAIN_SEPARATOR
);
x.replace(&parent_dir, "")
// Normalize paths to use unix style separators
.replace('\\', "/")
x.replace(&parent_dir, "").replace('\\', "/") // Normalize paths to use unix style separators
})
.collect();

Expand Down