Skip to content

Commit

Permalink
fix(cargo): treat 0 (packages) return value as None
Browse files Browse the repository at this point in the history
  • Loading branch information
grtcdr committed Jan 27, 2022
1 parent 3d17c30 commit 22a7df0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/shared/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,10 @@ pub(crate) fn count_cargo() -> Option<usize> {
if let Ok(cargo_home) = home::cargo_home() {
let bin = cargo_home.join("bin");
if let Ok(read_dir) = read_dir(bin) {
return Some(read_dir.count());
match read_dir.count() {
0 => None,
pkgs => Some(pkgs),
};
}
}

Expand Down

0 comments on commit 22a7df0

Please sign in to comment.