Closed bryantbiggs closed 1 year ago
I wonder if we need regex dependency at all.
we only use it in trim_flawed_dir
.
Given these test cases:
tcases.push(("/.foo-_bar/foo", "/.foo-_bar/".to_string()));
tcases.push(("/.foo-_bar/foo/", "/.foo-_bar/foo/".to_string()));
tcases.push(("/.foo-_bar/foo/bar", "/.foo-_bar/foo/".to_string()));
tcases.push(("/.foo-_bar/foo/bar/", "/.foo-_bar/foo/bar/".to_string()));
I feel like it should be relatively straightforward to rewrite it without regular expressions.
WDYT?
I wonder if we need regex dependency at all. we only use it in
trim_flawed_dir
.Given these test cases:
tcases.push(("/.foo-_bar/foo", "/.foo-_bar/".to_string())); tcases.push(("/.foo-_bar/foo/", "/.foo-_bar/foo/".to_string())); tcases.push(("/.foo-_bar/foo/bar", "/.foo-_bar/foo/".to_string())); tcases.push(("/.foo-_bar/foo/bar/", "/.foo-_bar/foo/bar/".to_string()));
I feel like it should be relatively straightforward to rewrite it without regular expressions.
WDYT?
Great point! Let me know what you think of the implementation
regex
crate to ensure the path ends at the correct/
which is a bit heavy handed for this use case, it has been replaced with an iterator based implementation