Skip to content

consider using env::var(CARGO) instead of looking for cargo in PATH #11943

Closed
@jyn514

Description

@jyn514

Description

Currently, cargo-clippy hard-codes cargo as the command to run and looks for it in PATH:

let mut cmd = Command::new("cargo");

This means that, e.g., running /home/jyn/.cargo/bin/cargo-clippy directly, without having ~/.cargo in PATH, will not work.

I cannot think of a use case where this would break things, but it makes me a little uncomfortable. Cargo sets the environment variable CARGO for subcommands: https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates
It would be nice if clippy defaulted to that environment variable before falling back to the cargo in PATH.

Version

clippy 0.1.76 (ae25d69dea5 2023-11-17)

Additional Labels

No response

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