Consistently use wrapping add to avoid overflow in debug when query starts with a separator

This commit is contained in:
Louis Dureuil 2023-05-29 10:08:27 +02:00
parent 087866d59f
commit 73198179f1
No known key found for this signature in database

View File

@ -77,13 +77,9 @@ pub fn located_query_terms_from_tokens(
} }
} }
TokenKind::Separator(separator_kind) => { TokenKind::Separator(separator_kind) => {
match separator_kind { // add penalty for hard separators
SeparatorKind::Hard => { if let SeparatorKind::Hard = separator_kind {
position += 1; position = position.wrapping_add(1);
}
SeparatorKind::Soft => {
position += 0;
}
} }
phrase = 'phrase: { phrase = 'phrase: {