Skip to content

Display cargo install crate-name rather than cargo add crate-name for binary crates #5882

Closed
@Aloso

Description

@Aloso

Current Behavior

crates.io has an "Install" sections with copy-paste snippets to install the crate. It includes these two snippets:

cargo add crate-name
crate-name = "version"

For binary crates (e.g. ripgrep) this is not useful.

Expected Behavior

For crates that have a binary target, but not a library target, crates.io should show instead:

cargo install crate-name

For crates that have both a binary target and a library target, crates.io should all three:

cargo add crate-name
crate-name = "version"
cargo install crate-name

Steps To Reproduce

  1. Go to https://crates.io/crates/ripgrep
  2. Look at the page

Environment

  • Browser: any
  • OS: irrelevant

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancement ✨Category: Adding new behavior or a change to the way an existing feature works

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions