Problem running `cargo +nightly fmt` with `[workspace.dependencies]`

I'm getting a failure when using cargo +nightly fmt. The ingredients you need to repro are

  1. Latests stable/nightly via. rustup
  2. Use a cargo workspace and specify some [workspace.dependencies]
  3. Run cargo +nightly fmt

Running on stable (cargo fmt) works but isn't an option for me because the project I'm working on uses some unstable fmt options.

The error message is

`cargo metadata` exited with an error: error: failed to parse manifest at `C:\path\to\workspace\Cargo.toml`

Caused by:
  error inheriting `arrayvec` from workspace root manifest's `workspace.dependencies.arrayvec`

Caused by:
  failed to parse manifest at `C:\path\to\Cargo.toml`

Caused by:
  this virtual manifest specifies a `lints` section, which is not allowed

I wonder if anyone has any ideas?

EDIT

Versions:

   stable-x86_64-pc-windows-msvc unchanged - rustc 1.75.0 (82e1608df 2023-12-21)
  nightly-x86_64-pc-windows-msvc unchanged - rustc 1.77.0-nightly (714b29a17 2024-01-15)

I'd try remove the [lints] section from your workspace's Cargo.toml file. Or rather, move its contents into [workspace.lints] as described here

1 Like

That worked - thanks very much!

1 Like