Skip to content

Commit 886e26e

Browse files
committed
refactor
.clone() makes clear we clone what's there instead of putting the focus on creating a path buffer from (what I thought) wasn't a path buffer.
1 parent 4546889 commit 886e26e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

git-discover/src/upwards.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,12 @@ pub(crate) mod function {
139139
cursor.as_ref()
140140
}
141141
.metadata()
142-
.map_err(|_| Error::InaccessibleDirectory {
143-
path: cursor.to_path_buf(),
144-
})?;
142+
.map_err(|_| Error::InaccessibleDirectory { path: cursor.clone() })?;
145143

146144
if device_id(&metadata) != initial_device {
147145
return Err(Error::NoGitRepositoryWithinFs {
148146
path: dir.into_owned(),
149-
limit: cursor.to_path_buf(),
147+
limit: cursor.clone(),
150148
});
151149
}
152150
}

0 commit comments

Comments
 (0)