mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-20 05:57:06 +04:00
minor: cloning filter and using count() is wasteful here
This commit is contained in:
parent
f843967059
commit
a3173c2280
@ -5002,16 +5002,20 @@ fn increment_impl(cx: &mut Context, increment_direction: IncrementDirection) {
|
||||
overlapping_indexes.insert(i + 1);
|
||||
}
|
||||
}
|
||||
let changes = changes.into_iter().enumerate().filter_map(|(i, change)| {
|
||||
if overlapping_indexes.contains(&i) {
|
||||
None
|
||||
} else {
|
||||
Some(change)
|
||||
}
|
||||
});
|
||||
let changes: Vec<_> = changes
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.filter_map(|(i, change)| {
|
||||
if overlapping_indexes.contains(&i) {
|
||||
None
|
||||
} else {
|
||||
Some(change)
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
if changes.clone().count() > 0 {
|
||||
let transaction = Transaction::change(doc.text(), changes);
|
||||
if !changes.is_empty() {
|
||||
let transaction = Transaction::change(doc.text(), changes.into_iter());
|
||||
let transaction = transaction.with_selection(selection.clone());
|
||||
|
||||
apply_transaction(&transaction, doc, view);
|
||||
|
Loading…
Reference in New Issue
Block a user