Now it can be written more nicely
This commit is contained in:
parent
fff15e983e
commit
eaa9d37a04
1 changed files with 5 additions and 29 deletions
|
@ -568,35 +568,11 @@ impl FuzzyBoundary {
|
|||
reach_boundary.map(|reach_start| (point, reach_start))
|
||||
};
|
||||
|
||||
let forwards = std::iter::successors(
|
||||
try_find_boundary_data(map, from, generate_boundary_data),
|
||||
|(previous_identifier, _)| {
|
||||
if *previous_identifier == map.max_point() {
|
||||
return None;
|
||||
}
|
||||
try_find_boundary_data(
|
||||
map,
|
||||
movement::right(map, *previous_identifier),
|
||||
generate_boundary_data,
|
||||
)
|
||||
},
|
||||
);
|
||||
let backwards = std::iter::successors(
|
||||
try_find_preceding_boundary_data(map, from, generate_boundary_data),
|
||||
|(previous_identifier, _)| {
|
||||
if *previous_identifier == DisplayPoint::zero() {
|
||||
return None;
|
||||
}
|
||||
try_find_preceding_boundary_data(
|
||||
map,
|
||||
movement::left(map, *previous_identifier),
|
||||
generate_boundary_data,
|
||||
)
|
||||
},
|
||||
);
|
||||
let boundaries = forwards
|
||||
.interleave(backwards)
|
||||
.take(2)
|
||||
let forwards = try_find_boundary_data(map, from, generate_boundary_data);
|
||||
let backwards = try_find_preceding_boundary_data(map, from, generate_boundary_data);
|
||||
let boundaries = [forwards, backwards]
|
||||
.into_iter()
|
||||
.filter_map(|data| data)
|
||||
.filter_map(|(identifier, reach_boundary)| reach_boundary(identifier, map))
|
||||
.filter(|boundary| match boundary.cmp(&from) {
|
||||
Ordering::Equal => true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue