diff rust/rhg/src/commands/files.rs @ 46135:cc6faec62cb7

rust: change &PathBuf parameters to &Path This is just as useful in function bodies, and a less strict requirement for callers. Differential Revision: https://phab.mercurial-scm.org/D9594
author Simon Sapin <simon.sapin@octobus.net>
date Mon, 14 Dec 2020 13:47:44 +0100
parents 8d6164098782
children dca9cb99971c
line wrap: on
line diff
--- a/rust/rhg/src/commands/files.rs	Wed Dec 16 21:06:29 2020 -0800
+++ b/rust/rhg/src/commands/files.rs	Mon Dec 14 13:47:44 2020 +0100
@@ -14,7 +14,7 @@
 use hg::requirements;
 use hg::utils::files::{get_bytes_from_path, relativize_path};
 use hg::utils::hg_path::{HgPath, HgPathBuf};
-use std::path::PathBuf;
+use std::path::Path;
 
 pub const HELP_TEXT: &str = "
 List tracked files.
@@ -34,13 +34,13 @@
     fn display_files(
         &self,
         ui: &Ui,
-        root: &PathBuf,
+        root: &Path,
         files: impl IntoIterator<Item = &'a HgPath>,
     ) -> Result<(), CommandError> {
         let cwd = std::env::current_dir()
             .or_else(|e| Err(CommandErrorKind::CurrentDirNotFound(e)))?;
         let rooted_cwd = cwd
-            .strip_prefix(&root)
+            .strip_prefix(root)
             .expect("cwd was already checked within the repository");
         let rooted_cwd = HgPathBuf::from(get_bytes_from_path(rooted_cwd));