From 4f55b8032292d9fd4d3cdcc348fd584f429f5b95 Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Mon, 14 Oct 2024 11:39:27 +0200 Subject: [PATCH] Remove unreachable code --- crates/meilisearch/src/search/mod.rs | 42 ++-------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/crates/meilisearch/src/search/mod.rs b/crates/meilisearch/src/search/mod.rs index 7832c1761..237e9dcf2 100644 --- a/crates/meilisearch/src/search/mod.rs +++ b/crates/meilisearch/src/search/mod.rs @@ -1808,45 +1808,9 @@ fn format_value( None => Value::String(old_string), } } - Value::Array(values) => Value::Array( - values - .into_iter() - .map(|v| { - format_value( - v, - builder, - format_options.map(|format_options| FormatOptions { - highlight: format_options.highlight, - crop: None, - }), - infos, - compute_matches, - locales, - ) - }) - .collect(), - ), - Value::Object(object) => Value::Object( - object - .into_iter() - .map(|(k, v)| { - ( - k, - format_value( - v, - builder, - format_options.map(|format_options| FormatOptions { - highlight: format_options.highlight, - crop: None, - }), - infos, - compute_matches, - locales, - ), - ) - }) - .collect(), - ), + // `map_leaf_values` makes sure this is only called for leaf fields + Value::Array(_) => unreachable!(), + Value::Object(_) => unreachable!(), Value::Number(number) => { let s = number.to_string();