Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

Improve PackageLink::dev_only documentation to indicate that it's local context only #420

Description

@nasifimtiazohi

Shouldn't an edge to any dependency to a dev dependency of a project be a dev_only edge? However, this API, guppy::graph::PackageLink::dev_only, returns false for such an edge. In this way, I am not sure how this API is different from guppy::graph::PackageLink::dev()::is_present().

For example, for a test crate that has guppy as a dev dependency and no other dependency specified in the crate to make sure guppy doesn't appear elsewhere in the dep-graph, below code

// The crate has a single dependency, `guppy` as a dev-dependency
let pkg = graph.packages().find(|p| p.name() == "guppy").unwrap();
for link in pkg.direct_links_directed(DependencyDirection::Forward){
    println!("{:?}, {:?}, {:?}, {:?}",
    link.to().name(), link.normal().is_present(),
    link.dev().is_present(), link.dev_only());
}

outputs:

running 1 test
"target-spec", true, false, false
"supercow", true, false, false
"serde_json", true, false, false
"serde", true, false, false
"semver", true, false, false
"petgraph", true, false, false
"pathdiff", true, false, false
"once_cell", true, false, false
"nested", true, false, false
"itertools", true, false, false
"indexmap", true, false, false
"fixedbitset", true, false, false
"cargo_metadata", true, false, false
"camino", true, false, false

However, guppy::graph::PackageLink::dev_only in its description says:

Return true if this edge is dev-only, i.e. code from this edge will not be included in normal builds.

Below is how my test crate looked like:

[dependencies]


[build-dependencies]

[dev-dependencies]
guppy = "0.9.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions