Skip to content

Give a more helpful error message for rustup which rustfmt if it's not installed #3321

@jyn514

Description

@jyn514

Problem you are trying to solve

These errors are inconsistent:

; rustup which rustfmt --toolchain beta
error: not a file: '/home/jyn/.local/lib/rustup/toolchains/beta-x86_64-unknown-linux-gnu/bin/rustfmt'
; rustfmt +beta
error: 'rustfmt' is not installed for the toolchain 'beta-x86_64-unknown-linux-gnu'
To install, run `rustup component add rustfmt --toolchain beta-x86_64-unknown-linux-gnu`

Solution you'd like

The second error here ('rustfmt not installed') seems more helpful; it would be nice to show that consistently.

Notes

; rustup --version
rustup 1.26.0 (5af9b9484 2023-04-05)

Note that this error message also happens for commands which aren't proxied:

; rustup which ls --toolchain beta
error: not a file: '/home/jyn/.local/lib/rustup/toolchains/beta-x86_64-unknown-linux-gnu/bin/ls'

I'm not sure the right thing to do here; maybe the current error is good enough?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions