Skip to content

Commit

Permalink
fix clap deprecations
Browse files Browse the repository at this point in the history
Run 'cargo check --features clap/deprecated' and fix all warnings
  • Loading branch information
klensy authored and ytmimi committed Mar 5, 2024
1 parent 21f353a commit 35c1b7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/cargo-fmt/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)]
Expand Down
6 changes: 3 additions & 3 deletions src/format-diff/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 35c1b7d

Please sign in to comment.