Skip to content

Add option to read version from rust-version in Cargo.toml #70

@nik-rev

Description

@nik-rev

I use nightly Rust in rust-toolchain.toml to get the nightly version of tools (clippy, rust-analyzer, rustfmt):

toolchain.channel = "nightly-2025-08-24"

But my project is supposed to build on stable rust 1.88. To do this, I set rust-version (MSRV) in Cargo.toml:

[package]
rust-version = "1.88"

In my CI I want to use toolchain of rust-version (stable) for these workflows:

  • cargo check
  • cargo test --workspace

And use the toolchain from rust-toolchain.toml for these workflows:

  • cargo clippy -- -D warnings (rust-toolchain.toml)
  • cargo fmt --check (rust-toolchain.toml)

To do that, I need to duplicate the entire components field from rust-toolchain.toml and I also duplicate the MSRV in the workflows. It would be nice to have a single source of truth for versions

Wanted behaviour

An input to the workflow to specify that I want the rust-version in Cargo.toml to override the version specified in rust-toolchain.toml. components field in rust-toolchain.toml should still be read.

I use your workflow in all of my projects, and I love it! Thanks for making it.

small question

if I have 2 workflows like this that use different toolchains - is it much more expensive than using the same toolchain for all workflows? Considering that they (probably) have to have 2 different caches for each toolchain

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions