Pre-feature request: suppress unused variable warning for unit-type arguments
Rust Internals [Unofficial]
March 11, 2026
Churn on introducing args would be reduced even further if you uniformly pattern matched the argument struct in every subcommand whether it has fields or not
use clap::Args;
use super::CommandError;
#[derive(Clone, Debug, Args)]
pub struct SubcommandWithNoOptionsArgs {}
pub fn subcommand_with_no_options_run(args: SubcommandWithNoOptionsArgs)
-> Result<(), CommandError> {
let SubcommandwithNoOptionsArgs { } = args;
Ok(())
}
Discussion in the ATmosphere