Open
Description
Describe The Bug
I'll preface this by saying that this issue is not blocking me in any way right now, but I noticed it while debugging some other issues I had so I'm reporting it now.
There's actually two issues I see here:
install-rustfmt
task does not take into account what toolchain is being used. Ifrust-fmt
is only installed forstable
, and you are running withnightly
,install-rustfmt
will not try to install the component for the nightly toolchain.- Since
nightly
rustfmt
is not installed, I would expect that when cargo make executes something requiring it, it should fail. Instead,cargo-make
defaults to using the stable version instead. I am unsure why whencargo-make
executesExecute Command: "rustup" "run" "nightly" "cargo" "fmt"
, it has different behaviour that invoking the command (rustup run nightly cargo fmt
) directly.
To Reproduce
[tasks.fmt-version]
dependencies = ["install-rustfmt"]
toolchain = "nightly"
command = "cargo"
args = ["fmt", "--version"]
> rustup uninstall nightly
> rustup install nightly --profile minimal
> cargo make fmt-version
cargo-make] INFO - cargo make 0.37.11
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Project: cargo-make
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: fmt-test
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: legacy-migration
[cargo-make] INFO - Execute Command: "rustup" "run" "nightly" "cargo" "fmt" "--version"
rustfmt 1.7.0-stable (7cf61ebd 2024-03-27)
[cargo-make] INFO - Build Done in 6.10 seconds.
> rustup run nightly cargo fmt --version
error: 'cargo-fmt.exe' is not installed for the toolchain 'nightly-x86_64-pc-windows-msvc'.
To install, run `rustup component add --toolchain {toolchain}rustfmt`
The above snipping shows both problems. install-rustup
did not install the nightly version of rustfmt
, and cargo-make
is for some reason behaving different from manually running the command (ie. its using stable rustfmt instead of erroring).