ok/jj
1
0
Fork 0
forked from mirrors/jj

refs: simplify inner loop of find_pair_to_remove() too

This commit is contained in:
Yuya Nishihara 2023-07-09 14:10:21 +09:00
parent fe3be99f0d
commit 528f6e23c1

View file

@ -87,10 +87,11 @@ fn find_pair_to_remove(
if removes.is_empty() {
return Some((None, add_index));
}
for (remove_index, remove) in removes.iter().enumerate() {
if index.is_ancestor(remove, add) {
return Some((Some(remove_index), add_index));
}
if let Some(remove_index) = removes
.iter()
.position(|remove| index.is_ancestor(remove, add))
{
return Some((Some(remove_index), add_index));
}
}
}