diff options
Diffstat (limited to 'helix-core/src/selection.rs')
-rw-r--r-- | helix-core/src/selection.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs index e9dea518..5f77d7ad 100644 --- a/helix-core/src/selection.rs +++ b/helix-core/src/selection.rs @@ -6,7 +6,7 @@ use crate::{ graphemes::{ ensure_grapheme_boundary_next, ensure_grapheme_boundary_prev, next_grapheme_boundary, }, - Assoc, ChangeSet, Rope, RopeSlice, + Assoc, ChangeSet, RopeSlice, }; use smallvec::{smallvec, SmallVec}; use std::borrow::Cow; @@ -426,10 +426,8 @@ pub fn select_on_matches( // TODO: can't avoid occasional allocations since Regex can't operate on chunks yet let fragment = sel.fragment(text); - let mut sel_start = sel.from(); - let sel_end = sel.to(); - - let mut start_byte = text.char_to_byte(sel_start); + let sel_start = sel.from(); + let start_byte = text.char_to_byte(sel_start); for mat in regex.find_iter(&fragment) { // TODO: retain range direction @@ -466,10 +464,10 @@ pub fn split_on_matches( // TODO: can't avoid occasional allocations since Regex can't operate on chunks yet let fragment = sel.fragment(text); - let mut sel_start = sel.from(); + let sel_start = sel.from(); let sel_end = sel.to(); - let mut start_byte = text.char_to_byte(sel_start); + let start_byte = text.char_to_byte(sel_start); let mut start = sel_start; @@ -492,11 +490,12 @@ pub fn split_on_matches( #[cfg(test)] mod test { use super::*; + use crate::Rope; #[test] #[should_panic] fn test_new_empty() { - let sel = Selection::new(smallvec![], 0); + let _ = Selection::new(smallvec![], 0); } #[test] |