Skip to content

Commit 5ed8d67

Browse files
Craig-Macomberepage
authored andcommitted
fix(info): Suggest a more universal cargo tree command
Passing a package to `--package` is for workspace members; we need to pass it to `--invert`. This is part of #14993
1 parent e3f6477 commit 5ed8d67

File tree

12 files changed

+24
-24
lines changed

12 files changed

+24
-24
lines changed

src/cargo/ops/cargo_update.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,9 @@ fn print_lockfile_updates(
689689
}
690690

691691
if ws.gctx().shell().verbosity() == Verbosity::Verbose {
692-
ws.gctx().shell().note(
693-
"to see how you depend on a package, run `cargo tree --invert --package <dep>@<ver>`",
694-
)?;
692+
ws.gctx()
693+
.shell()
694+
.note("to see how you depend on a package, run `cargo tree --invert <dep>@<ver>`")?;
695695
} else {
696696
if 0 < unchanged_behind {
697697
ws.gctx().shell().note(format!(

src/cargo/ops/registry/info/view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ fn suggest_cargo_tree(package_id: PackageId, shell: &mut Shell) -> CargoResult<(
400400
let literal = LITERAL;
401401

402402
shell.note(format_args!(
403-
"to see how you depend on {name}, run `{literal}cargo tree --invert --package {name}@{version}{literal:#}`",
403+
"to see how you depend on {name}, run `{literal}cargo tree --invert {name}@{version}{literal:#}`",
404404
name = package_id.name(),
405405
version = package_id.version(),
406406
))

tests/testsuite/cargo_info/specify_version_within_ws_and_match_with_lockfile/stderr.term.svg

Lines changed: 2 additions & 2 deletions
Loading

tests/testsuite/cargo_info/transitive_dependency_within_ws/direct1-stderr.term.svg

Lines changed: 2 additions & 2 deletions
Loading

tests/testsuite/cargo_info/transitive_dependency_within_ws/direct2-stderr.term.svg

Lines changed: 2 additions & 2 deletions
Loading

tests/testsuite/cargo_info/transitive_dependency_within_ws/transitive1-stderr.term.svg

Lines changed: 2 additions & 2 deletions
Loading

tests/testsuite/cargo_info/transitive_dependency_within_ws/transitive2-stderr.term.svg

Lines changed: 2 additions & 2 deletions
Loading

tests/testsuite/cargo_info/transitive_dependency_within_ws/ws-stderr.term.svg

Lines changed: 2 additions & 2 deletions
Loading

tests/testsuite/cargo_info/within_ws/stderr.term.svg

Lines changed: 2 additions & 2 deletions
Loading

tests/testsuite/cargo_info/within_ws_without_lockfile/stderr.term.svg

Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)