Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix clap deprecations #6101

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}");
Comment on lines -212 to +213
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here (i guess) is enough newlines written.

}

#[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
Loading