diff --git a/helix-core/src/test.rs b/helix-core/src/test.rs index 7183302c6..71c71cce2 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 f2b78a118..f82751051 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 d286a85cc..b2bb53ac2 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> { - 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 {