Skip to content

Commit 42875c9

Browse files
committed
Clarify to_unix_separators{,_on_windows} relationship
`to_native_path_on_windows` already called `to_windows_separators` to do what would otherwise repeat logic of `to_windows_separators`, but `to_unix_separators_on_windows` repeated the code of `to_unix_separators`. Having `to_unix_separators_on_windows` call `to_unix_separators` instead of repeating its logic seems slightly easier to read, elucidates the relationship between the several functions, and might be slightly more maintainable. This is purely a refactoring, which should not change the effect. It should also not change performance, since the compiler should be able to inline the call in circumstnaces where that would help.
1 parent 0286351 commit 42875c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gix-path/src/convert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ pub fn to_native_path_on_windows<'a>(path: impl Into<Cow<'a, BStr>>) -> Cow<'a,
222222
pub fn to_unix_separators_on_windows<'a>(path: impl Into<Cow<'a, BStr>>) -> Cow<'a, BStr> {
223223
#[cfg(windows)]
224224
{
225-
replace(path, b'\\', b'/')
225+
to_unix_separators(path)
226226
}
227227
#[cfg(not(windows))]
228228
{

0 commit comments

Comments
 (0)