From d781a6164a36ed831270a87ab5bc1fe0d1a34e93 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Mon, 8 Mar 2021 16:27:52 +0100 Subject: [PATCH] Rewrite some code with idiomatic Rust --- milli/src/search/criteria/proximity.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/milli/src/search/criteria/proximity.rs b/milli/src/search/criteria/proximity.rs index 259c3a1cf..5b14f699c 100644 --- a/milli/src/search/criteria/proximity.rs +++ b/milli/src/search/criteria/proximity.rs @@ -357,9 +357,9 @@ fn resolve_plane_sweep_candidates( ) -> Option<(Position, u8, Position)> { // take the inner proximity of the first group as initial - let mut proximity = groups.first()?.1.1; - let left_most_pos = groups.first()?.1.0; - let right_most_pos = groups.last()?.1.2; + let (_, (_, mut proximity, _)) = groups.first()?; + let (_, (left_most_pos, _, _)) = groups.first()?; + let (_, (_, _, right_most_pos)) = groups.last()?; for pair in groups.windows(2) { 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 !consecutive || proximity == 0 { - Some((left_most_pos, proximity, right_most_pos)) + Some((*left_most_pos, proximity, *right_most_pos)) } else { None }