cargo-nightly

Crates.iocargo-nightly
lib.rscargo-nightly
version0.0.2
created_at2026-01-07 21:43:02.126018+00
updated_at2026-01-16 01:21:31.877116+00
descriptionCargo subcommand to forward commands to the nightly toolchain, enabling nightly toolchain usage in cargo aliases
homepagehttps://github.com/dataroadinc/cargo-nightly
repositoryhttps://github.com/dataroadinc/cargo-nightly
max_upload_size
id2029061
size149,072
Jacobus Geluk (jgeluk)

documentation

https://docs.rs/cargo-nightly

README

cargo-nightly

Crates.io Documentation CI License: CC-BY-SA-4.0 Downloads

Cargo subcommand that forwards commands to the nightly toolchain, enabling nightly toolchain usage in cargo aliases.

Why it exists

Cargo aliases in .cargo/config.toml cannot directly use +nightly syntax because cargo aliases can only invoke cargo subcommands, not external commands or toolchain selectors. This plugin provides a cargo-nightly subcommand that forwards all arguments to cargo +nightly <args>, making it possible to use nightly toolchain commands through cargo aliases.

The Problem

If you try to use +nightly directly in a cargo alias:

[alias]
clippy2 = "+nightly clippy"  # ❌ This doesn't work

You'll get an error:

error: no such command: `+nightly`
help: invoke `cargo` through `rustup` to handle `+toolchain` directives

The Solution

With cargo-nightly installed, you can create aliases like:

[alias]
clippy2 = "nightly clippy"
check2 = "nightly clippy"
clippy-all = "nightly clippy --workspace --all-targets --all-features -- -D warnings"

When you run cargo clippy2, cargo will:

  1. Look for a cargo-nightly subcommand
  2. cargo-nightly forwards to cargo +nightly clippy
  3. The nightly toolchain runs your command

Installation

Using cargo-binstall (Recommended)

First install cargo-binstall if you haven't already:

cargo install cargo-binstall

Then install cargo-nightly:

cargo binstall cargo-nightly

Using cargo install

cargo install cargo-nightly

Usage

Once installed, you can use it directly:

cargo nightly clippy
cargo nightly check
cargo nightly build

Or through aliases in .cargo/config.toml:

[alias]
# Use nightly clippy for comprehensive linting
clippy2 = "nightly clippy"
check2 = "nightly clippy"

# Comprehensive clippy checks
clippy-all = "nightly clippy --workspace --all-targets --all-features -- -D warnings"
clippy-fix = "nightly clippy --fix --workspace --all-targets --all-features --allow-dirty --allow-staged"
clippy-strict = "nightly clippy --workspace --all-targets --all-features -- -D warnings -D clippy::pedantic"

# Quick fixes
fixlib = "nightly clippy --fix --lib --allow-dirty"

Then use the aliases:

cargo clippy2
cargo check2
cargo clippy-all

How it works

The cargo-nightly command is a simple wrapper that:

  1. Takes all arguments after nightly
  2. Executes cargo +nightly <args>
  3. Forwards stdin, stdout, and stderr
  4. Exits with the same exit code

This allows cargo to recognize nightly as a subcommand, which can then be used in aliases.

License

Creative Commons Attribution-ShareAlike 4.0 International License - see LICENSE file for details.

Commit count: 17

cargo fmt