Do a first clippy pass

This commit is contained in:
Clément Renault 2025-06-03 14:47:39 +02:00
parent 3c218cc3a0
commit 8fdcdee0cc
No known key found for this signature in database
GPG key ID: F250A4C4E3AE5F5F
7 changed files with 22 additions and 27 deletions

View file

@ -1984,7 +1984,7 @@ impl TryFrom<f64> for RankingScoreThreshold {
type Error = InvalidSearchRankingScoreThreshold;
fn try_from(value: f64) -> StdResult<Self, Self::Error> {
if value < 0.0 || value > 1.0 {
if !(0.0..=1.0).contains(&value) {
Err(InvalidSearchRankingScoreThreshold)
} else {
Ok(RankingScoreThreshold(value))

View file

@ -69,11 +69,6 @@ impl From<ChatConfig> for ChatSettings {
HybridQuery { semantic_ratio: SemanticRatio(semantic_ratio), embedder }
});
let matching_strategy = matching_strategy.map(MatchingStrategy::from);
let ranking_score_threshold =
ranking_score_threshold.map(RankingScoreThreshold::from);
ChatSearchParams {
hybrid: Setting::some_or_not_set(hybrid),
limit: Setting::some_or_not_set(limit),

View file

@ -23,7 +23,7 @@ use crate::error::UserError;
use crate::fields_ids_map::metadata::{FieldIdMapWithMetadata, MetadataBuilder};
use crate::filterable_attributes_rules::match_faceted_field;
use crate::index::{
ChatConfig, IndexEmbeddingConfig, MatchingStrategy, PrefixSearch, RankingScoreThreshold,
ChatConfig, IndexEmbeddingConfig, PrefixSearch,
SearchParameters, DEFAULT_MIN_WORD_LEN_ONE_TYPO, DEFAULT_MIN_WORD_LEN_TWO_TYPOS,
};
use crate::order_by_map::OrderByMap;
@ -1326,7 +1326,7 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
},
matching_strategy: match matching_strategy {
Setting::Set(matching_strategy) => {
Some(MatchingStrategy::from(*matching_strategy))
Some(*matching_strategy)
}
Setting::Reset => None,
Setting::NotSet => search_parameters.matching_strategy,
@ -1341,7 +1341,7 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
}
},
ranking_score_threshold: match ranking_score_threshold {
Setting::Set(rst) => Some(RankingScoreThreshold::from(*rst)),
Setting::Set(rst) => Some(*rst),
Setting::Reset => None,
Setting::NotSet => search_parameters.ranking_score_threshold,
},