diff options
author | Blaž Hrastnik | 2020-09-12 14:52:38 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2020-09-12 14:52:38 +0000 |
commit | f098166571fd8fc2046d49355dffc0d2aad29e50 (patch) | |
tree | 59df40d5a6541f6102c6ab8d10deb04f863312e4 /helix-core/src/selection.rs | |
parent | f9348d77ec4e128799ca407a1612aa61691f05a5 (diff) |
Get rid of a bunch of clones.
Diffstat (limited to 'helix-core/src/selection.rs')
-rw-r--r-- | helix-core/src/selection.rs | 7 |
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, + ) } } |