aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/selection.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-09-12 14:52:38 +0000
committerBlaž Hrastnik2020-09-12 14:52:38 +0000
commitf098166571fd8fc2046d49355dffc0d2aad29e50 (patch)
tree59df40d5a6541f6102c6ab8d10deb04f863312e4 /helix-core/src/selection.rs
parentf9348d77ec4e128799ca407a1612aa61691f05a5 (diff)
Get rid of a bunch of clones.
Diffstat (limited to 'helix-core/src/selection.rs')
-rw-r--r--helix-core/src/selection.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs
index a196417a..f6ca424f 100644
--- a/helix-core/src/selection.rs
+++ b/helix-core/src/selection.rs
@@ -211,11 +211,14 @@ impl Selection {
}
/// Takes a closure and maps each selection over the closure.
- pub fn transform<F>(self, f: F) -> Self
+ pub fn transform<F>(&self, f: F) -> Self
where
F: Fn(Range) -> Range,
{
- Self::new(self.ranges.into_iter().map(f).collect(), self.primary_index)
+ Self::new(
+ self.ranges.iter().copied().map(f).collect(),
+ self.primary_index,
+ )
}
}