:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(flags): mirror array-exact short-circuit refactor in IcontainsMulti (#58131)
Patricio445035a1f7c8
diff --git a/rust/feature-flags/src/properties/property_matching.rs b/rust/feature-flags/src/properties/property_matching.rsindex ec231fa17d68..dac15e215138 100644--- a/rust/feature-flags/src/properties/property_matching.rs+++ b/rust/feature-flags/src/properties/property_matching.rs@@ -159,22 +159,17 @@ pub fn match_property(if let Some(match_value) = match_value {let match_string = to_string_representation(match_value).to_ascii_lowercase();- // Handle both single values and arrays- let search_values: Vec<String> = match value {- Value::Array(arr) => arr- .iter()- .map(|v| to_string_representation(v).to_ascii_lowercase())- .collect(),- single_value => {- vec![to_string_representation(single_value).to_ascii_lowercase()]- }+ // Check if any of the search values is contained in the match value.+ // Handle both single values and arrays without materializing an+ // intermediate Vec — short-circuits the per-element lowercase work too.+ let any_contained = match value {+ Value::Array(arr) => arr.iter().any(|v| {+ match_string.contains(&to_string_representation(v).to_ascii_lowercase())+ }),+ single_value => match_string+ .contains(&to_string_representation(single_value).to_ascii_lowercase()),};- // Check if any of the search values is contained in the match value- let any_contained = search_values- .iter()- .any(|search_val| match_string.contains(search_val));-if operator == OperatorType::IcontainsMulti {Ok(any_contained)} else {