Unnamed repository; edit this file 'description' to name the repository.
perf: use `next_back` on `DoubleEndedIterator`
Rolo 11 months ago
parent 1bc45c8 · commit 5b72b59
-rw-r--r--helix-core/src/test.rs2
-rw-r--r--helix-lsp/src/client.rs2
-rw-r--r--helix-view/src/register.rs3
3 files changed, 4 insertions, 3 deletions
diff --git a/helix-core/src/test.rs b/helix-core/src/test.rs
index 7183302c..71c71cce 100644
--- a/helix-core/src/test.rs
+++ b/helix-core/src/test.rs
@@ -65,7 +65,7 @@ pub fn print(s: &str) -> (String, Selection) {
let head_at_beg = iter.next_if_eq(&"|").is_some();
let last_grapheme = |s: &str| {
UnicodeSegmentation::graphemes(s, true)
- .last()
+ .next_back()
.map(String::from)
};
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs
index f2b78a11..f8275105 100644
--- a/helix-lsp/src/client.rs
+++ b/helix-lsp/src/client.rs
@@ -39,7 +39,7 @@ fn workspace_for_uri(uri: lsp::Url) -> WorkspaceFolder {
lsp::WorkspaceFolder {
name: uri
.path_segments()
- .and_then(|segments| segments.last())
+ .and_then(|mut segments| segments.next_back())
.map(|basename| basename.to_string())
.unwrap_or_default(),
uri,
diff --git a/helix-view/src/register.rs b/helix-view/src/register.rs
index d286a85c..b2bb53ac 100644
--- a/helix-view/src/register.rs
+++ b/helix-view/src/register.rs
@@ -145,7 +145,8 @@ impl Registers {
}
pub fn last<'a>(&'a self, name: char, editor: &'a Editor) -> Option<Cow<'a, str>> {
- self.read(name, editor).and_then(|values| values.last())
+ self.read(name, editor)
+ .and_then(|mut values| values.next_back())
}
pub fn iter_preview(&self) -> impl Iterator<Item = (char, &str)> {