Skip to content

Commit d0d7344

Browse files
committed
store PathBuf instead of String
1 parent 43edaf3 commit d0d7344

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/utils.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn strip_verbatim_from_prefix(prefix: &PrefixComponent<'_>) -> Option<PathBuf> {
5353
#[derive(Debug)]
5454
struct RemoveError {
5555
kind: std::io::ErrorKind,
56-
path: String,
56+
path: PathBuf,
5757
}
5858

5959
impl std::error::Error for RemoveError {}
@@ -62,7 +62,8 @@ impl std::fmt::Display for RemoveError {
6262
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6363
f.write_fmt(format_args!(
6464
"failed to remove '{}' : {:?}",
65-
self.path, self.kind
65+
self.path.display(),
66+
self.kind
6667
))
6768
}
6869
}
@@ -72,7 +73,7 @@ pub(crate) fn improve_remove_error(error: std::io::Error, path: &Path) -> std::i
7273
error.kind(),
7374
RemoveError {
7475
kind: error.kind(),
75-
path: path.display().to_string(),
76+
path: path.to_path_buf(),
7677
},
7778
)
7879
}

0 commit comments

Comments
 (0)