Skip to content

Commit 7b95523

Browse files
committed
Don't call .ok() before unwrap_or()
It's not necessary, and adds noise.
1 parent 8375cf4 commit 7b95523

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/cargo/sources/path.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,9 @@ impl<'gctx> PathSource<'gctx> {
260260
Ok(None)
261261
}
262262

263-
/// Returns [`Some(gix::Repository)`](gix::Repository) if there is a sibling `Cargo.toml` and `.git`
264-
/// directory; otherwise, the caller should fall back on full file list.
263+
/// Returns [`Some(gix::Repository)`](gix::Repository) if the discovered repository
264+
/// (searched upwards from `root`) contains a tracked `Cargo.toml`. Otherwise,
265+
/// the caller should fall back on full file list.
265266
fn discover_gix_repo(&self, root: &Path) -> CargoResult<Option<gix::Repository>> {
266267
let repo = match gix::ThreadSafeRepository::discover(root) {
267268
Ok(repo) => repo.to_thread_local(),
@@ -496,7 +497,7 @@ impl<'gctx> PathSource<'gctx> {
496497

497498
let pkg_path = pkg.root();
498499
let mut target_prefix;
499-
let repo_relative_pkg_path = pkg_path.strip_prefix(root).ok().unwrap_or(Path::new(""));
500+
let repo_relative_pkg_path = pkg_path.strip_prefix(root).unwrap_or(Path::new(""));
500501

501502
let pathspec = {
502503
let mut include = gix::path::to_unix_separators_on_windows(gix::path::into_bstr(

0 commit comments

Comments
 (0)