Mercurial > hg
comparison rust/rhg/src/utils/path_utils.rs @ 49914:58074252db3c
rust: run `cargo clippy`
These automatic fixes are good to have because they make the code
more idiomatic and less surprising.
The transform from `sort` -> `sort_unstable` is questionable, but this is
only in a test, so it doesn't matter in our case.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 09 Jan 2023 17:40:03 +0100 |
parents | 9b0e1f64656f |
children |
comparison
equal
deleted
inserted
replaced
49913:c15b415d1bff | 49914:58074252db3c |
---|---|
21 pub fn new(repo: &Repo) -> Result<Self, HgError> { | 21 pub fn new(repo: &Repo) -> Result<Self, HgError> { |
22 let cwd = current_dir()?; | 22 let cwd = current_dir()?; |
23 let repo_root = repo.working_directory_path(); | 23 let repo_root = repo.working_directory_path(); |
24 let repo_root = cwd.join(repo_root); // Make it absolute | 24 let repo_root = cwd.join(repo_root); // Make it absolute |
25 let repo_root_hgpath = | 25 let repo_root_hgpath = |
26 HgPathBuf::from(get_bytes_from_path(repo_root.to_owned())); | 26 HgPathBuf::from(get_bytes_from_path(&repo_root)); |
27 | 27 |
28 if let Ok(cwd_relative_to_repo) = cwd.strip_prefix(&repo_root) { | 28 if let Ok(cwd_relative_to_repo) = cwd.strip_prefix(&repo_root) { |
29 // The current directory is inside the repo, so we can work with | 29 // The current directory is inside the repo, so we can work with |
30 // relative paths | 30 // relative paths |
31 Ok(Self { | 31 Ok(Self { |