-
Notifications
You must be signed in to change notification settings - Fork 5
Conversation
Signed-off-by: hi-rustin <[email protected]>
b438761
to
46f8230
Compare
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔢 Self-check
src/ops/info.rs
Outdated
@@ -29,12 +33,19 @@ pub fn info(spec: &str, config: &Config, reg_or_index: Option<RegistryOrIndex>) | |||
if let Ok(root) = root_manifest(None, config) { | |||
let ws = Workspace::new(&root, config)?; | |||
if let Some(resolve) = ops::load_pkg_lockfile(&ws)? { | |||
if let Ok(p) = resolve.query(spec) { | |||
if let Ok(p) = resolve.query(spec.name()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You likely want to call specs_to_ids
. It can return multiple results, just pick the highest.
- Avoids the need for the
matches
call below - Picks a value when there is ambiguity, rather than erroring and falling through to the registry (we should have a test case added for this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little bit confused. It seems the specs_to_ids
API also uses the query
API internally.
It can only return one matched package or bail out an error:
/// Checks a list of `PackageId`s to find 1 that matches this `PackageIdSpec`. If 0, 2, or
/// more are found, then this returns an error.
pub fn query<I>(&self, i: I) -> CargoResult<PackageId>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overlooked that. We likely want to just call .iter()
and do our own calls to matches
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Signed-off-by: hi-rustin <[email protected]>
5e6864e
to
f661faf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔢 Self-check
license: unknown | ||
rust-version: unknown | ||
documentation: https://docs.rs/my-package/0.2.3+my-package | ||
note: to see how you depend on my-package, run `cargo tree --package [email protected]+my-package --invert` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two versions were compared and the highest one was chosen.
Signed-off-by: hi-rustin <[email protected]>
f661faf
to
091ab5d
Compare
close #27