containerd / rust-extensions

Rust crates to extend containerd
https://containerd.io
Apache License 2.0
184 stars 74 forks source link

deps: Remove the use of the `regex` crate #201

Closed bryantbiggs closed 1 year ago

bryantbiggs commented 1 year ago
mxpv commented 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?

bryantbiggs commented 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?

Great point! Let me know what you think of the implementation