fix clap deprecations

Run 'cargo check --features clap/deprecated' and fix all warnings
This commit is contained in:
klensy 2024-02-29 12:51:23 +03:00 committed by Yacin Tmimi
parent 21f353a637
commit 35c1b7d734
2 changed files with 6 additions and 7 deletions

View File

@ -61,7 +61,7 @@ pub struct Opts {
/// Options passed to rustfmt
// 'raw = true' to make `--` explicit.
#[arg(name = "rustfmt_options", raw = true)]
#[arg(id = "rustfmt_options", raw = true)]
rustfmt_options: Vec<String>,
/// Format all packages, and also their local path-based dependencies
@ -209,9 +209,8 @@ fn convert_message_format_to_rustfmt_args(
fn print_usage_to_stderr(reason: &str) {
eprintln!("{reason}");
let app = Opts::command();
app.after_help("")
.write_help(&mut io::stderr())
.expect("failed to write to stderr");
let help = app.after_help("").render_help();
eprintln!("{help}");
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]

View File

@ -38,14 +38,14 @@ enum FormatDiffError {
}
#[derive(Parser, Debug)]
#[clap(
#[command(
name = "rustfmt-format-diff",
disable_version_flag = true,
next_line_help = true
)]
pub struct Opts {
/// Skip the smallest prefix containing NUMBER slashes
#[clap(
#[arg(
short = 'p',
long = "skip-prefix",
value_name = "NUMBER",
@ -54,7 +54,7 @@ pub struct Opts {
skip_prefix: u32,
/// Custom pattern selecting file paths to reformat
#[clap(
#[arg(
short = 'f',
long = "filter",
value_name = "PATTERN",