rust-regex: fix shortcut for exact matches
The current shortcut for rootglobs that can be simplified to exact matches
does not work, it instead treats the pattern as a regex, which is not the
same thing.
This changes fixes the behavior and introduces a test for this behavior.
Differential Revision: https://phab.mercurial-scm.org/D6489