Skip to content

cargo tree -i <package> don't require disambiguation when multiple versions are present in the dependency tree #17352

Description

@Skgland

Problem

Currently cargo tree -i <package> doesn't work when <package> is present multiple times in the dependency tree.

cargo tree -i winnow
error: specification `winnow` is ambiguous
help: re-run this command with one of the following specifications
  winnow@0.7.15
  winnow@1.0.4

cargo tree already allows -i package@<version> to be repeated in a single invocation.

e.g. (adding --depth to limit the size, but works without)

cargo tree -i winnow@1 -i winnow@0.7 --depth 1
winnow v0.7.15
└── toml v0.9.12+spec-1.1.0

winnow v1.0.4
├── toml v1.1.4+spec-1.1.0
│   [dev-dependencies]
├── toml v1.1.4+spec-1.1.0
└── toml_parser v1.1.3+spec-1.1.0

Proposed Solution

cargo tree -i <package> should behave as if each version was specified

I.e. for the winnow example above cargo tree -i winnow should act as if cargo tree -i winnow@0.7 -i winnow@1 was specified on the command line.

Notes

I find it useful to look at the inverse dependency trees of duplicate dependencies -d to see which can easily be eliminated.

I usually use cargo tree -d --depth 0 to find the list of duplicates, but cargo tree -d
without duplicates is hard to follow the dependency path and with duplicates the tree gets too large.

Basically error: specification `winnow` is ambiguous, yes it is, please show me all of them, I want to see them all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-treeS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions