Skip to content

Commit

Permalink
perf: use .next_back() to get the last component
Browse files Browse the repository at this point in the history
Using `.last()` needs to go through all components first instead of
splitting only the last one.
  • Loading branch information
samueltardieu committed Jan 2, 2025
1 parent 9048e80 commit 39bdd5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cli/src/merge_tools/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ pub fn run_mergetool_external(
};

let temp_dir = new_utf8_temp_dir("jj-resolve-").map_err(ExternalToolError::SetUpDir)?;
let suffix = if let Some(filename) = repo_path.components().last() {
let suffix = if let Some(filename) = repo_path.components().next_back() {
let name = filename
.to_fs_name()
.map_err(|err| err.with_path(repo_path))?;
Expand Down

0 comments on commit 39bdd5e

Please sign in to comment.