Skip to content

Search backend: eliminate slice mutation

Administrator requested to merge cc/no-mutate-patterns into main

Created by: camdencheek

findPatternRevs currently mutates its input slice, includePatterns, seemingly to avoid the extra allocation from creating a new slice. However, at some point, we started copying the slice on the input side to avoid race conditions, defeating the purpose of mutating the slice and making the code more difficult to follow. This just modifies findPatternRevs so that it no longer mutates the input slice and returns the a new slice with the modified include patterns.

Test plan

Semantics-preserving. Depending on existing tests.

Merge request reports

Loading