From 45cfecc003f37832f6d1e7f4620d9f87cd33bcd5 Mon Sep 17 00:00:00 2001 From: XSpielinbox <55600187+xspielinbox@users.noreply.github.com> Date: Tue, 28 Apr 2026 11:51:52 +0200 Subject: [PATCH] Replace deprecated clap attributes --- src/main.rs | 52 +++++++++++++++++++++++----------------------- src/proxy/cargo.rs | 2 +- src/summary.rs | 16 +++++++------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/main.rs b/src/main.rs index fe67a66..04db2ce 100644 --- a/src/main.rs +++ b/src/main.rs @@ -67,7 +67,7 @@ use symbol_graph::ScanOutputs; use tmpdir::TempDir; #[derive(Parser, Debug, Clone)] -#[clap()] +#[command()] struct OuterArgs { #[command(subcommand)] command: OuterCommand, @@ -79,100 +79,100 @@ enum OuterCommand { } #[derive(Parser, Debug, Clone, Default)] -#[clap(version, about)] +#[command(version, about)] struct Args { /// Directory containing crate to analyze. Defaults to current working directory. - #[clap(long)] + #[arg(long)] path: Option, /// Path to cackle.toml. Defaults to cackle.toml in the directory containing Cargo.toml. - #[clap(short, long)] + #[arg(short, long)] cackle_path: Option, /// Print the mapping from paths to crate names. Useful for debugging. - #[clap(long, hide = true)] + #[arg(long, hide = true)] print_path_to_crate_map: bool, /// Promotes warnings (e.g. due to unused permissions) to errors. - #[clap(long)] + #[arg(long)] fail_on_warnings: bool, /// Ignore newer config versions. - #[clap(long)] + #[arg(long)] ignore_newer_config_versions: bool, /// Whether to use coloured output. - #[clap(long, alias = "color", default_value = "auto")] + #[arg(long, alias = "color", default_value = "auto")] colour: colour::Colour, /// Don't print anything on success. - #[clap(long)] + #[arg(long)] quiet: bool, /// Override the target used when compiling. e.g. "x86_64-unknown-linux-gnu". - #[clap(long)] + #[arg(long)] target: Option, /// Override build profile. - #[clap(long)] + #[arg(long)] profile: Option, /// Features to pass to cargo. Overrides common.features in config. - #[clap(long)] + #[arg(long)] features: Option, /// Print how long various things take to run. - #[clap(long)] + #[arg(long)] print_timing: bool, /// Print additional information that's probably only useful for debugging. - #[clap(long)] + #[arg(long)] debug: bool, /// Output file for logs that might be useful for diagnosing problems. - #[clap(long)] + #[arg(long)] log_file: Option, /// How detailed the logs should be. - #[clap(long, default_value = "info")] + #[arg(long, default_value = "info")] log_level: logging::LevelFilter, /// When specified, writes all requests into a subdirectory of the target directory. For /// debugging use. - #[clap(long, hide = true)] + #[arg(long, hide = true)] save_requests: bool, /// Instead of running `cargo build`, replay requests saved by a previous run where /// --write-requests was specified. For debugging use. - #[clap(long, hide = true)] + #[arg(long, hide = true)] replay_requests: bool, /// Temporary directory for Cackle to use. This is intended for testing purposes. - #[clap(long, hide = true)] + #[arg(long, hide = true)] tmpdir: Option, /// What kind of user interface to use. - #[clap(long)] + #[arg(long)] ui: Option, /// Disable interactive UI. - #[clap(long, short)] + #[arg(long, short)] no_ui: bool, /// Automatically accept the default (first) fix for all problems. /// When multiple fixes are available, always applies the most sensible option. /// Useful for automated configuration generation. - #[clap(long)] + #[arg(long)] auto_accept_fixes: bool, /// Disable backtraces (may reduce peak memory consumption). - #[clap(long)] + #[arg(long)] no_backtrace: bool, // We may at some point allow this to be a short flag, but should probably wait a few releases. // -p was previously accepted for --path. /// Packages to build and analyse. - #[clap(long)] + #[arg(long)] package: Vec, #[command(subcommand)] @@ -190,13 +190,13 @@ enum Command { /// Run `cargo run`, analysing whatever gets built. Run(CargoOptions), - #[clap(hide = true, name = PROXY_BIN_ARG)] + #[command(hide = true, name = PROXY_BIN_ARG)] ProxyBin(ProxyBinOptions), } #[derive(Parser, Debug, Clone)] pub(crate) struct ProxyBinOptions { - #[clap(allow_hyphen_values = true)] + #[arg(allow_hyphen_values = true)] remaining: Vec, } diff --git a/src/proxy/cargo.rs b/src/proxy/cargo.rs index baac119..1e123ec 100644 --- a/src/proxy/cargo.rs +++ b/src/proxy/cargo.rs @@ -10,7 +10,7 @@ pub(crate) const PROFILE_NAME_ENV: &str = "CACKLE_BUILD_PROFILE"; #[derive(Parser, Debug, Clone)] pub(crate) struct CargoOptions { - #[clap(allow_hyphen_values = true)] + #[arg(allow_hyphen_values = true)] remaining: Vec, } diff --git a/src/summary.rs b/src/summary.rs index 9c85d34..1d1ae8e 100644 --- a/src/summary.rs +++ b/src/summary.rs @@ -27,33 +27,33 @@ pub enum OutputFormat { #[derive(Parser, Debug, Clone)] pub(crate) struct SummaryOptions { /// Print summary by package. - #[clap(long)] + #[arg(long)] by_package: bool, /// Print summary by permission. - #[clap(long)] + #[arg(long)] by_permission: bool, /// Call out proc macros with other permissions. - #[clap(long)] + #[arg(long)] impure_proc_macros: bool, /// Print counts. - #[clap(long)] + #[arg(long)] counts: bool, /// Print all summary kinds. This is the default if no options are specified. - #[clap(long)] + #[arg(long)] full: bool, /// Whether to print headers for each summary section. This is forced on if more than one /// summary is selected. - #[clap(long)] + #[arg(long)] print_headers: bool, /// The format of the output - #[clap(long, value_enum, action)] - #[clap(default_value_t = OutputFormat::Human)] + #[arg(long, value_enum)] + #[arg(default_value_t = OutputFormat::Human)] output_format: OutputFormat, }