Skip to content

Suggested cargo fix command does not specify +nightly #11605

@Muscraft

Description

@Muscraft

Problem

When running cargo with cargo +nightly check the suggested cargo fix command does not include +nightly i.e.

warning: `scratch` (bin "scratch") generated 1 warning (run `cargo fix --bin "scratch"` to apply 1 suggestion)

It seems like a misstep to be showing the "command to run" but not having it include +nightly.

Steps

  1. Have a nightly version of cargo installed
  2. Run cargo new scratch && cd scratch
  3. Edit the main function to throw a machine-fixable warning
fn main() {
    let test = 0;
}
  1. Run cargo +nightly check
  2. Observe the warning line

Possible Solution(s)

  • No Change
  • Just refer to the command, not saying how to run it
  • Try to detect the use of rustup and which toolchain is being used and specify the + (which might be redundant with rustup-toolchain.toml)
  • Do a modified version of cargo test: to apply 1 suggestion pass '...' to cargo-fix

Notes

No response

Version

cargo 1.68.0-nightly (8c460b223 2023-01-04)
release: 1.68.0-nightly
commit-hash: 8c460b2237a6359a7e3335890db8da049bdd62fc
commit-date: 2023-01-04
host: aarch64-apple-darwin
libgit2: 1.5.0 (sys:0.15.0 vendored)
libcurl: 7.85.0 (sys:0.4.59+curl-7.86.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
os: Mac OS 13.1.0 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.C-bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions