Refactor common code from `match` and `match_all`

The private functions that implement our matching algorithm (`_matches`
and its helper `_find_matches`) now always yield at least one result. If
there were any matches (1 or more), they'll yield the matches. If there
were no matches at all, they'll yield a single result for the best (but
not good enough) match.

That way, `match` merely has to take the first result, and `match_all`
lazily filters out non-matches from the sequence.

This means we don't have to pass the `match_one` parameter around the
helper functions. I think this makes the code simpler.