join_segments -> build_glob_string

- this is a more descriptive name
This commit is contained in:
cyqsimon 2023-11-02 20:21:07 +08:00
parent 827b3eca2f
commit 64840fbbae
No known key found for this signature in database
GPG Key ID: 1D8CE2F297390D65
2 changed files with 4 additions and 4 deletions

View File

@ -138,7 +138,7 @@ impl Matcher {
// parser logic ensures that this case can only happen when there are dynamic segments
_ => {
let segments_codegen = self.0.iter().map(MatcherSegment::codegen).join(", ");
let closure = format!("|| join_segments(&[{segments_codegen}])");
let closure = format!("|| build_glob_string(&[{segments_codegen}])");
format!("BuiltinMatcher::Dynamic(Lazy::new({closure}))")
}
}

View File

@ -42,11 +42,11 @@ impl BuiltinMatcher {
}
}
/// Join a list of matcher segments, replacing all environment variables.
/// Returns `None` if any replacement fails.
/// Join a list of matcher segments to create a glob string, replacing all
/// environment variables. Returns `None` if any replacement fails.
///
/// Used internally by `BuiltinMatcher::Dynamic`'s lazy evaluation closure.
fn join_segments(segs: &[MatcherSegment]) -> Option<String> {
fn build_glob_string(segs: &[MatcherSegment]) -> Option<String> {
let mut buf = String::new();
for seg in segs {
match seg {