rust: use owned types in `Matcher`
This simplifies the code a lot, allows for some refactoring to come.
The original code tried to prevent allocations that were already happening
anyway beforehand.
## Avoid interference from actual test env:unset HGTEST_JOBSunset HGTEST_TIMEOUTunset HGTEST_PORTunset HGTEST_SHELL