mirror of
https://github.com/openharmony/third_party_rust_regex.git
synced 2026-06-30 21:37:57 -04:00
e3b21e91f1
The previous implementation didn't bail out of the replace loop when the limit was reached until one more than the total number of 'find' operations had completed. By moving the limit check to the end of the loop body, we execute only the number of 'find' operations that is necessary, instead of one extra. This optimization only applies to 'replacen' calls with a limit not equal to '0'. That includes 'replace' but not 'replace_all'. PR #930