From 7bbe7a985a1ed5cc1043e1c8582b4c7e17efc5b7 Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 7 Mar 2024 12:58:11 +0300 Subject: [PATCH] fix clap 4 deprecated warnings $ cargo check --features clap/deprecated warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> crox\src\main.rs:47:7 | 47 | #[clap(required_unless_present = "dir")] | ^^^^ | = note: `#[warn(deprecated)]` on by default warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> crox\src\main.rs:50:7 | 50 | #[clap(long = "dir")] | ^^^^ warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> crox\src\main.rs:53:7 | 53 | #[clap(long = "collapse-threads")] | ^^^^ warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> crox\src\main.rs:56:7 | 56 | #[clap(long = "minimum-duration")] | ^^^^ warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> mmview\src\main.rs:12:7 | 12 | #[clap(short = 't', long = "thread-id")] | ^^^^ | = note: `#[warn(deprecated)]` on by default warning: `crox` (bin "crox") generated 4 warnings warning: `mmview` (bin "mmview") generated 1 warning warning: use of deprecated function `::augment_subcommands::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[command(...)]` --> mmedit\src\main.rs:15:7 | 15 | #[clap(name = "truncate")] | ^^^^ | = note: `#[warn(deprecated)]` on by default warning: `mmedit` (bin "mmedit") generated 1 warning warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> summarize\src\main.rs:28:7 | 28 | #[clap(short = 'e', long = "exclude")] | ^^^^ | = note: `#[warn(deprecated)]` on by default warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> summarize\src\main.rs:31:7 | 31 | #[clap(long = "json")] | ^^^^ warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> summarize\src\main.rs:40:7 | 40 | #[clap(long = "json")] | ^^^^ warning: use of deprecated function `::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> summarize\src\main.rs:44:7 | 44 | #[clap(short = 'p', long = "percent-above", default_value = "0.0")] | ^^^^ warning: use of deprecated function `::augment_subcommands::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[command(...)]` --> summarize\src\main.rs:51:7 | 51 | #[clap(name = "aggregate")] | ^^^^ warning: use of deprecated function `::augment_subcommands::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[command(...)]` --> summarize\src\main.rs:54:7 | 54 | #[clap(name = "diff")] | ^^^^ warning: use of deprecated function `::augment_subcommands::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[command(...)]` --> summarize\src\main.rs:58:7 | 58 | #[clap(name = "summarize")] | ^^^^ --- crox/Cargo.toml | 2 +- crox/src/main.rs | 8 ++++---- flamegraph/Cargo.toml | 2 +- mmedit/Cargo.toml | 2 +- mmedit/src/main.rs | 2 +- mmview/Cargo.toml | 2 +- mmview/src/main.rs | 2 +- stack_collapse/Cargo.toml | 2 +- summarize/Cargo.toml | 2 +- summarize/src/main.rs | 14 +++++++------- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/crox/Cargo.toml b/crox/Cargo.toml index 02259a5..2cbfe15 100644 --- a/crox/Cargo.toml +++ b/crox/Cargo.toml @@ -10,4 +10,4 @@ analyzeme = { path = "../analyzeme" } rustc-hash = "1.0.1" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5.0", features = ["derive"] } diff --git a/crox/src/main.rs b/crox/src/main.rs index 14f113d..f4063a1 100644 --- a/crox/src/main.rs +++ b/crox/src/main.rs @@ -44,16 +44,16 @@ struct Event { #[derive(Parser, Debug)] struct Opt { - #[clap(required_unless_present = "dir")] + #[arg(required_unless_present = "dir")] file_prefix: Vec, /// all event trace files in dir will be merged to one chrome_profiler.json file - #[clap(long = "dir")] + #[arg(long = "dir")] dir: Option, /// collapse threads without overlapping events - #[clap(long = "collapse-threads")] + #[arg(long = "collapse-threads")] collapse_threads: bool, /// filter out events with shorter duration (in microseconds) - #[clap(long = "minimum-duration")] + #[arg(long = "minimum-duration")] minimum_duration: Option, } diff --git a/flamegraph/Cargo.toml b/flamegraph/Cargo.toml index 4a4a6f1..439c0a9 100644 --- a/flamegraph/Cargo.toml +++ b/flamegraph/Cargo.toml @@ -11,5 +11,5 @@ license = "MIT OR Apache-2.0" [dependencies] measureme = { path = "../measureme" } analyzeme = { path = "../analyzeme" } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5.0", features = ["derive"] } inferno = { version = "0.11", default-features = false } diff --git a/mmedit/Cargo.toml b/mmedit/Cargo.toml index 181e077..d51590b 100644 --- a/mmedit/Cargo.toml +++ b/mmedit/Cargo.toml @@ -6,4 +6,4 @@ edition = "2018" [dependencies] measureme = { path = "../measureme" } decodeme = { path = "../decodeme" } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5.0", features = ["derive"] } diff --git a/mmedit/src/main.rs b/mmedit/src/main.rs index f27821f..5cdb784 100644 --- a/mmedit/src/main.rs +++ b/mmedit/src/main.rs @@ -12,7 +12,7 @@ struct TruncateOpt { #[derive(Parser, Debug)] enum Opt { /// Truncate to a single page per tag - #[clap(name = "truncate")] + #[command(name = "truncate")] Truncate(TruncateOpt), } diff --git a/mmview/Cargo.toml b/mmview/Cargo.toml index 5f6c2a3..8e0b541 100644 --- a/mmview/Cargo.toml +++ b/mmview/Cargo.toml @@ -8,4 +8,4 @@ license = "MIT OR Apache-2.0" [dependencies] analyzeme = { path = "../analyzeme" } measureme = { path = "../measureme" } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5.0", features = ["derive"] } diff --git a/mmview/src/main.rs b/mmview/src/main.rs index ea71217..79989f9 100644 --- a/mmview/src/main.rs +++ b/mmview/src/main.rs @@ -9,7 +9,7 @@ struct Opt { file_prefix: PathBuf, /// Filter to events which occured on the specified thread id - #[clap(short = 't', long = "thread-id")] + #[arg(short = 't', long = "thread-id")] thread_id: Option, } diff --git a/stack_collapse/Cargo.toml b/stack_collapse/Cargo.toml index fbf3db4..d5f3d66 100644 --- a/stack_collapse/Cargo.toml +++ b/stack_collapse/Cargo.toml @@ -8,4 +8,4 @@ license = "MIT OR Apache-2.0" [dependencies] measureme = { path = "../measureme" } analyzeme = { path = "../analyzeme" } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5.0", features = ["derive"] } diff --git a/summarize/Cargo.toml b/summarize/Cargo.toml index 8b58a3c..74c4c63 100644 --- a/summarize/Cargo.toml +++ b/summarize/Cargo.toml @@ -12,4 +12,4 @@ prettytable-rs = "0.10" rustc-hash = "1.0.1" serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5.0", features = ["derive"] } diff --git a/summarize/src/main.rs b/summarize/src/main.rs index 2b2af55..9c3ce65 100644 --- a/summarize/src/main.rs +++ b/summarize/src/main.rs @@ -25,10 +25,10 @@ struct DiffOpt { base: PathBuf, change: PathBuf, - #[clap(short = 'e', long = "exclude")] + #[arg(short = 'e', long = "exclude")] exclude: Vec, - #[clap(long = "json")] + #[arg(long = "json")] json: bool, } @@ -37,25 +37,25 @@ struct SummarizeOpt { file_prefix: PathBuf, /// Writes the analysis to a json file next to instead of stdout - #[clap(long = "json")] + #[arg(long = "json")] json: bool, /// Filter the output to items whose self-time is greater than this value - #[clap(short = 'p', long = "percent-above", default_value = "0.0")] + #[arg(short = 'p', long = "percent-above", default_value = "0.0")] percent_above: f64, } #[derive(Parser, Debug)] enum Opt { /// Processes a set of trace files with identical events and analyze variance - #[clap(name = "aggregate")] + #[command(name = "aggregate")] Aggregate(AggregateOpt), - #[clap(name = "diff")] + #[command(name = "diff")] Diff(DiffOpt), /// Processes trace files and produces a summary - #[clap(name = "summarize")] + #[command(name = "summarize")] Summarize(SummarizeOpt), }