E0080#
Warning name: regex_match_missing_before
A lexmatch pattern can skip an input prefix, but the pattern does
not bind or explicitly ignore that prefix.
An unanchored regex searches forward from the start of the input. Add ^ when
the match must start at the beginning, or add before= to bind or ignore the
skipped prefix.
Erroneous example#
///|
pub fn ends_with_digits(input : String) -> Bool {
lexmatch input {
re"[0-9]+$" => true
_ => false
}
}
Suggestion#
Anchor the regex at the start, or make the skipped prefix explicit with
before=prefix or before=_.
///|
pub fn ends_with_digits(input : String) -> Bool {
lexmatch input {
(re"[0-9]+$", before=_) => true
_ => false
}
}