fuzzy-matcher
fuzzy-matcher copied to clipboard
Fix panic when turning off `use_cache`
The main problem with the old code was that all of the cache RefCells
were held for too long because of the huge scope of the fuzzy
function. The problem was already solved by just wrapping some of the
code with an extra scope {
+ }
. However I chose to refactor a bit
and split the old function into 3 new ones:
-
simple_match
- was already there -
sophisticated_match
- basically the else case ofsimple_match
-
fuzzy_inner
- a function just for the control flow of the other function. This also handles the cache invalidation
This should supersede the pull request https://github.com/lotabout/fuzzy-matcher/pull/20