mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-24 13:40:31 +01:00
Rewrite some code with idiomatic Rust
This commit is contained in:
parent
b18ec00a7a
commit
d781a6164a
@ -357,9 +357,9 @@ fn resolve_plane_sweep_candidates(
|
|||||||
) -> Option<(Position, u8, Position)>
|
) -> Option<(Position, u8, Position)>
|
||||||
{
|
{
|
||||||
// take the inner proximity of the first group as initial
|
// take the inner proximity of the first group as initial
|
||||||
let mut proximity = groups.first()?.1.1;
|
let (_, (_, mut proximity, _)) = groups.first()?;
|
||||||
let left_most_pos = groups.first()?.1.0;
|
let (_, (left_most_pos, _, _)) = groups.first()?;
|
||||||
let right_most_pos = groups.last()?.1.2;
|
let (_, (_, _, right_most_pos)) = groups.last()?;
|
||||||
|
|
||||||
for pair in groups.windows(2) {
|
for pair in groups.windows(2) {
|
||||||
if let [(i1, (_, _, rpos1)), (i2, (lpos2, prox2, _))] = pair {
|
if let [(i1, (_, _, rpos1)), (i2, (lpos2, prox2, _))] = pair {
|
||||||
@ -379,7 +379,7 @@ fn resolve_plane_sweep_candidates(
|
|||||||
|
|
||||||
// if groups should be consecutives, we will only accept groups with a proximity of 0
|
// if groups should be consecutives, we will only accept groups with a proximity of 0
|
||||||
if !consecutive || proximity == 0 {
|
if !consecutive || proximity == 0 {
|
||||||
Some((left_most_pos, proximity, right_most_pos))
|
Some((*left_most_pos, proximity, *right_most_pos))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user