Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misleading warning if rustfmt is not handled by rustup #1352

Open
matthiaskrgr opened this Issue Feb 4, 2018 · 4 comments

Comments

4 participants
@matthiaskrgr
Copy link

matthiaskrgr commented Feb 4, 2018

I installed rustfmt-nightly via cargo install rustfmt-nightly.
When doing rustup update, I get a warning

warning: tool `rustfmt` is already installed, remove it from `/home/matthias/.cargo/bin`, then run `rustup update` to have rustup manage this tool.
warning: tool `cargo-fmt` is already installed, remove it from `/home/matthias/.cargo/bin`, then run `rustup update` to have rustup manage this tool.

which sounds like cargo uninstall rustfmt-nightly ; rustup update will automatically reinstall rustfmt via rustup however this does not seem to be the case.
Apparently I have to manually activate it via rustup component add --toolchain nightly rustfmt-preview.
Can we improve this warning message somehow, it's quite a bit misleading in my opinion. :/

@indygreg

This comment has been minimized.

Copy link

indygreg commented Feb 12, 2018

I just ran into this and was about to file the same bug. Here's the output from my terminal for context:

$ rustup update
...
info: downloading self-update

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.23.0 (766bd11c8 2018-01-01)
      beta-x86_64-unknown-linux-gnu updated - rustc 1.24.0-beta.11 (03f456d3c 2018-02-03)
   nightly-x86_64-unknown-linux-gnu updated - rustc 1.25.0-nightly (b8398d947 2018-02-11)

warning: tool `rustfmt` is already installed, remove it from `/home/gps/.cargo/bin`, then run `rustup update` to have rustup manage this tool.
warning: tool `cargo-fmt` is already installed, remove it from `/home/gps/.cargo/bin`, then run `rustup update` to have rustup manage this tool.

$ cargo uninstall rustfmt
    Removing /home/gps/.cargo/bin/cargo-fmt
    Removing /home/gps/.cargo/bin/rustfmt

$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'beta-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: checking for self-updates

   stable-x86_64-unknown-linux-gnu unchanged - rustc 1.23.0 (766bd11c8 2018-01-01)
     beta-x86_64-unknown-linux-gnu unchanged - rustc 1.24.0-beta.11 (03f456d3c 2018-02-03)
  nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.25.0-nightly (b8398d947 2018-02-11)

At this point I was scratching my head as to how to actually install rustfmt and cargo-fmt with rustup. I'm still not sure to be honest :/

@daboross

This comment has been minimized.

Copy link

daboross commented Feb 13, 2018

I'm pretty sure rustup will just want to own rustfmt and cargo-fmt whether or not it actually has binaries to back them with.

rustup update
rustup component add rustfmt-preview

works for me to install it most of the time (sometimes nightly versions don't have rustup at all..)


Regardless of that, it would be nice if rustup did not emit this warning when no toolchain has "rustfmt-preview" installed. If there's no chance that it can provide rustfmt/cargo-fmt, it should not complain about not being able to own those binaries.

@richardwhiuk

This comment has been minimized.

Copy link

richardwhiuk commented Sep 6, 2018

This warning implies that it should just be removed - but surely a user should use cargo uninstall rustfmt instead?

@daboross

This comment has been minimized.

Copy link

daboross commented Sep 7, 2018

If rustfmt was installed with cargo and you do want to replace it with the `rustup one, that's the right solution. Changing the message seems like it would be a different issue, though.

Ideally rustup shouldn't ask the user to remove it at all if none of the rustup toolchains have rustfmt installed in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.