cargo_nightly/lib.rs
1//! Cargo subcommand to forward commands to the nightly toolchain.
2//!
3//! This extension enables nightly toolchain usage in cargo aliases by
4//! providing a `cargo-nightly` subcommand that forwards all arguments to
5//! `cargo +nightly <args>`.
6//!
7//! ## Why it exists
8//!
9//! Cargo aliases in `.cargo/config.toml` cannot directly use `+nightly`
10//! syntax because cargo aliases can only invoke cargo subcommands, not
11//! external commands or toolchain selectors. This plugin provides a
12//! `cargo-nightly` subcommand that forwards all arguments to
13//! `cargo +nightly <args>`, making it possible to use nightly toolchain
14//! commands through cargo aliases.
15//!
16//! ## Usage
17//!
18//! Once installed, you can use it directly:
19//!
20//! ```bash
21//! cargo nightly clippy
22//! cargo nightly check
23//! ```
24//!
25//! Or through aliases in `.cargo/config.toml`:
26//!
27//! ```toml
28//! [alias]
29//! clippy2 = "nightly clippy"
30//! check2 = "nightly clippy"
31//! ```
32//!
33//! ## Example
34//!
35//! ```toml
36//! # .cargo/config.toml
37//! [alias]
38//! clippy2 = "nightly clippy"
39//! check2 = "nightly clippy"
40//! clippy-all = "nightly clippy --workspace --all-targets --all-features -- -D warnings"
41//! ```
42//!
43//! Then use the aliases:
44//!
45//! ```bash
46//! cargo clippy2
47//! cargo check2
48//! cargo clippy-all
49//! ```