s/Lazy<GlobMatcher>/Lazy<Option<GlobMatcher>>/

This commit is contained in:
cyqsimon 2023-11-05 01:49:01 +08:00
parent cfd622d6e1
commit 4ad3002543
No known key found for this signature in database
GPG Key ID: 1D8CE2F297390D65
2 changed files with 4 additions and 4 deletions

View File

@ -41,7 +41,7 @@ impl MappingTarget {
#[derive(Clone, Debug, PartialEq, Eq, Hash, DeserializeFromStr)] #[derive(Clone, Debug, PartialEq, Eq, Hash, DeserializeFromStr)]
/// A single matcher. /// A single matcher.
/// ///
/// Codegen converts this into a `Lazy<GlobMatcher>`. /// Codegen converts this into a `Lazy<Option<GlobMatcher>>`.
struct Matcher(Vec<MatcherSegment>); struct Matcher(Vec<MatcherSegment>);
/// Parse a matcher. /// Parse a matcher.
/// ///

View File

@ -52,7 +52,7 @@ include!(concat!(
/// ///
/// A failure to compile is a fatal error. /// A failure to compile is a fatal error.
/// ///
/// Used internally by `Lazy<GlobMatcher>`'s lazy evaluation closure. /// Used internally by `Lazy<Option<GlobMatcher>>`'s lazy evaluation closure.
fn build_matcher_fixed(from: &str) -> GlobMatcher { fn build_matcher_fixed(from: &str) -> GlobMatcher {
make_glob_matcher(from).expect("A builtin fixed glob matcher failed to compile") make_glob_matcher(from).expect("A builtin fixed glob matcher failed to compile")
} }
@ -63,7 +63,7 @@ fn build_matcher_fixed(from: &str) -> GlobMatcher {
/// Returns `None` if any replacement fails, or if the joined glob string fails /// Returns `None` if any replacement fails, or if the joined glob string fails
/// to compile. /// to compile.
/// ///
/// Used internally by `Lazy<GlobMatcher>`'s lazy evaluation closure. /// Used internally by `Lazy<Option<GlobMatcher>>`'s lazy evaluation closure.
fn build_matcher_dynamic(segs: &[MatcherSegment]) -> Option<GlobMatcher> { fn build_matcher_dynamic(segs: &[MatcherSegment]) -> Option<GlobMatcher> {
// join segments // join segments
let mut buf = String::new(); let mut buf = String::new();
@ -83,7 +83,7 @@ fn build_matcher_dynamic(segs: &[MatcherSegment]) -> Option<GlobMatcher> {
/// A segment of a dynamic builtin matcher. /// A segment of a dynamic builtin matcher.
/// ///
/// Used internally by `Lazy<GlobMatcher>`'s lazy evaluation closure. /// Used internally by `Lazy<Option<GlobMatcher>>`'s lazy evaluation closure.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
enum MatcherSegment { enum MatcherSegment {
Text(&'static str), Text(&'static str),