fuzzy-matcher icon indicating copy to clipboard operation
fuzzy-matcher copied to clipboard

Fix panic when turning off `use_cache`

Open RobWalt opened this issue 1 week ago • 0 comments

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 of simple_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

RobWalt avatar Jun 29 '24 10:06 RobWalt