Closed
Description
The document explains SetMatches::len()
as “the total number of regexes in the set that created these matches”.
At first sight, I thought SetMatches
as a collection of matched regular expression indices, so naturally, I expect the following function to always return true
:
fn f(s: &SetMatches) -> bool {
s.len() == s.iter().count()
}
But it seems that this method always returns the number of all regular expressions in the corresponding RegexSet
object, not the number of matched regular expressions.
I think the name of len()
strongly suggests that it is consistent with the behavior of iter()
, maybe it’s better to rename this method or add a better explanation to reduce confusion.