E0081#
Warning name: regex_match_missing_after
A non-streaming lexscan pattern can leave an unmatched input suffix, but the
pattern does not bind or explicitly ignore that suffix.
For String and StringView inputs, add $ when the match must end with the
input, or add after= to bind or ignore the remaining suffix.
Erroneous example#
///|
pub fn starts_with_digits(input : String) -> Bool {
lexscan input {
re"^[0-9]+" => true
_ => false
}
}
Suggestion#
Anchor the regex at the end, or make the suffix explicit with after=suffix or
after=_.
///|
pub fn starts_with_digits(input : String) -> Bool {
lexscan input {
(re"^[0-9]+", after=_) => true
_ => false
}
}