Skip to content

Commit

Permalink
fix clap 4 deprecated warnings
Browse files Browse the repository at this point in the history
$ cargo check --features clap/deprecated
warning: use of deprecated function `<Opt as clap::Args>::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 `<Opt as clap::Args>::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 `<Opt as clap::Args>::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 `<Opt as clap::Args>::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 `<Opt as clap::Args>::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 `<Opt as clap::Subcommand>::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 `<DiffOpt as clap::Args>::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 `<DiffOpt as clap::Args>::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 `<SummarizeOpt as clap::Args>::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 `<SummarizeOpt as clap::Args>::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 `<Opt as clap::Subcommand>::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 `<Opt as clap::Subcommand>::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 `<Opt as clap::Subcommand>::augment_subcommands::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[command(...)]`
  --> summarize\src\main.rs:58:7
   |
58 |     #[clap(name = "summarize")]
   |       ^^^^
  • Loading branch information
klensy authored and michaelwoerister committed Mar 7, 2024
1 parent 43c3c80 commit 7bbe7a9
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion crox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
8 changes: 4 additions & 4 deletions crox/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ struct Event {

#[derive(Parser, Debug)]
struct Opt {
#[clap(required_unless_present = "dir")]
#[arg(required_unless_present = "dir")]
file_prefix: Vec<PathBuf>,
/// all event trace files in dir will be merged to one chrome_profiler.json file
#[clap(long = "dir")]
#[arg(long = "dir")]
dir: Option<PathBuf>,
/// 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<u128>,
}

Expand Down
2 changes: 1 addition & 1 deletion flamegraph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
2 changes: 1 addition & 1 deletion mmedit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
2 changes: 1 addition & 1 deletion mmedit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}

Expand Down
2 changes: 1 addition & 1 deletion mmview/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
2 changes: 1 addition & 1 deletion mmview/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u32>,
}

Expand Down
2 changes: 1 addition & 1 deletion stack_collapse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
2 changes: 1 addition & 1 deletion summarize/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
14 changes: 7 additions & 7 deletions summarize/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ struct DiffOpt {
base: PathBuf,
change: PathBuf,

#[clap(short = 'e', long = "exclude")]
#[arg(short = 'e', long = "exclude")]
exclude: Vec<String>,

#[clap(long = "json")]
#[arg(long = "json")]
json: bool,
}

Expand All @@ -37,25 +37,25 @@ struct SummarizeOpt {
file_prefix: PathBuf,

/// Writes the analysis to a json file next to <file_prefix> 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),
}

Expand Down

0 comments on commit 7bbe7a9

Please sign in to comment.