Skip to content

Commit

Permalink
Merge pull request #235 from deg4uss3r/main
Browse files Browse the repository at this point in the history
Fixed unwrap error when checking for VersionReq and using a git repos…
  • Loading branch information
Ricky authored Aug 20, 2020
2 parents f45f2a7 + 950e95b commit 3416541
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-outdated"
version = "0.9.11"
version = "0.9.12"
authors = [
"Kevin K. <[email protected]>",
"Frederick Z. <[email protected]>",
Expand Down
11 changes: 10 additions & 1 deletion src/cargo_ops/temp_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,16 @@ impl<'tmp> TempProject<'tmp> {
}
})
.unwrap_or_else(|| {
self.warn(format!("cannot compare {} crate version found in toml {} with crates.io latest {}", name, version_req.as_ref().unwrap(), query_result[0].version())).unwrap();

// If the version_req cannot be found use the version
// this happens when we use a git repository as a dependency, without specifying
// the version in Cargo.toml, preventing us from needing an unwrap below in the warn
let ver_req = match version_req {
Some(v_r) => format!("{}", v_r),
None => format!("{}", version),
};

self.warn(format!("cannot compare {} crate version found in toml {} with crates.io latest {}", name, ver_req, query_result[0].version())).unwrap();
//this returns the latest version
&query_result[0]
});
Expand Down

0 comments on commit 3416541

Please sign in to comment.