diff options
author | Blaž Hrastnik | 2021-02-18 09:34:22 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-02-18 09:34:22 +0000 |
commit | c9dd1c930edee68a32ef19ee407820c247937b05 (patch) | |
tree | 667de4906e291df3b1dc1e6f71460415e4eb2501 /helix-lsp/src | |
parent | bd85460698c8d74f1a7b79c286a627c3ffcfb67e (diff) |
treewide: &RopeSlice -> RopeSlice. It's Copy so no reason to pass by ref
Diffstat (limited to 'helix-lsp/src')
-rw-r--r-- | helix-lsp/src/client.rs | 4 | ||||
-rw-r--r-- | helix-lsp/src/lib.rs | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index d27beea8..52cd85c1 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -303,7 +303,7 @@ impl Client { new_pos += i; } Delete(_) => { - let start = pos_to_lsp_pos(&new_text, new_pos); + let start = pos_to_lsp_pos(new_text, new_pos); let end = traverse(start, old_text.slice(old_pos..old_end)); // deletion @@ -314,7 +314,7 @@ impl Client { }); } Insert(s) => { - let start = pos_to_lsp_pos(&new_text, new_pos); + let start = pos_to_lsp_pos(new_text, new_pos); new_pos += s.chars().count(); diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index b0c84ff5..a51a11fc 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -30,12 +30,12 @@ pub mod util { use super::*; use helix_core::{RopeSlice, State, Transaction}; - pub fn lsp_pos_to_pos(doc: &RopeSlice, pos: lsp::Position) -> usize { + pub fn lsp_pos_to_pos(doc: RopeSlice, pos: lsp::Position) -> usize { let line = doc.line_to_char(pos.line as usize); let line_start = doc.char_to_utf16_cu(line); doc.utf16_cu_to_char(pos.character as usize + line_start) } - pub fn pos_to_lsp_pos(doc: &RopeSlice, pos: usize) -> lsp::Position { + pub fn pos_to_lsp_pos(doc: RopeSlice, pos: usize) -> lsp::Position { let line = doc.char_to_line(pos); let line_start = doc.char_to_utf16_cu(doc.line_to_char(line)); let col = doc.char_to_utf16_cu(pos) - line_start; @@ -58,8 +58,8 @@ pub mod util { None }; - let start = lsp_pos_to_pos(&doc, edit.range.start); - let end = lsp_pos_to_pos(&doc, edit.range.end); + let start = lsp_pos_to_pos(doc, edit.range.start); + let end = lsp_pos_to_pos(doc, edit.range.end); (start, end, replacement) }), ) |