summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi-Yu Yu <aaronyu@google.com>2024-04-30 04:25:39 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-05-01 13:22:33 +0000
commitc1fef72b483a733638303727a91561063ae13d3f (patch)
tree2c252d869d975e38ee4c7e62d6771b10aea874dc
parent7af0755360c4ad578e28782d00c5b3c82819b158 (diff)
downloadadhd-c1fef72b483a733638303727a91561063ae13d3f.tar.gz
Fix cargo check --features clap/deprecated for 4.x
Fix more deprecated uses post clap version bump. BUG=b:337717817 FIXED=b:337717817 TEST=cargo check --features clap/deprecated Change-Id: I5ce7c0975ac212fbdc4f7626df6e657caf273a82 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/5500462 Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org> Tested-by: chromeos-cop-builder@chromeos-cop.iam.gserviceaccount.com <chromeos-cop-builder@chromeos-cop.iam.gserviceaccount.com> Commit-Queue: Li-Yu Yu <aaronyu@google.com>
-rw-r--r--audio_processor/src/bin/offline-pipeline.rs12
-rw-r--r--cras/client/cras_tests/src/arguments.rs54
-rw-r--r--cras/client/cras_tests/src/getter.rs8
-rw-r--r--cras/client/cras_tests/src/setter.rs10
-rw-r--r--rock/src/cosine.rs2
-rw-r--r--rules/cbindgen/src/main.rs12
6 files changed, 49 insertions, 49 deletions
diff --git a/audio_processor/src/bin/offline-pipeline.rs b/audio_processor/src/bin/offline-pipeline.rs
index c272cbfb..d915f63f 100644
--- a/audio_processor/src/bin/offline-pipeline.rs
+++ b/audio_processor/src/bin/offline-pipeline.rs
@@ -31,29 +31,29 @@ struct Command {
/// Time in seconds to sleep between each processing block iteration.
/// A value of 0 causes the running thread to yield instead of sleeping.
- #[clap(long = "sleep-sec", value_parser = parse_duration)]
+ #[arg(long = "sleep-sec", value_parser = parse_duration)]
sleep_duration: Option<Duration>,
/// Symbol name of the function that creates the plugin processor in `plugin`.
- #[clap(long, default_value = "plugin_processor_create")]
+ #[arg(long, default_value = "plugin_processor_create")]
plugin_name: String,
/// Block size of the processor, in milliseconds.
- #[clap(long, default_value = "10")]
+ #[arg(long, default_value = "10")]
block_size_ms: usize,
/// Block size of the processor, in frames.
/// Takes precedence over --block-size-ms.
- #[clap(long)]
+ #[arg(long)]
block_size_frames: Option<usize>,
/// Also print JSON profile results in stdout.
- #[clap(long)]
+ #[arg(long)]
json: bool,
/// The number of output channels.
/// If not specified, assumes output channels equals to input channels.
- #[clap(long)]
+ #[arg(long)]
output_channels: Option<u16>,
}
diff --git a/cras/client/cras_tests/src/arguments.rs b/cras/client/cras_tests/src/arguments.rs
index dde53269..f724278f 100644
--- a/cras/client/cras_tests/src/arguments.rs
+++ b/cras/client/cras_tests/src/arguments.rs
@@ -72,9 +72,9 @@ impl fmt::Display for FileType {
/// This struct will be passed to `playback()` and `capture()`.
#[derive(Debug, PartialEq, Clone, ValueEnum)]
pub enum LoopbackType {
- #[clap(name = "pre_dsp")]
+ #[value(name = "pre_dsp")]
PreDsp,
- #[clap(name = "post_dsp")]
+ #[value(name = "post_dsp")]
PostDsp,
}
@@ -83,35 +83,35 @@ pub struct AudioOptions {
pub file_name: PathBuf,
/// Buffer size in frames
- #[clap(short = 'b', long = "buffer_size")]
+ #[arg(short = 'b', long = "buffer_size")]
pub buffer_size: Option<usize>,
/// Number of channels
- #[clap(short = 'c', long = "channels")]
+ #[arg(short = 'c', long = "channels")]
pub num_channels: Option<usize>,
/// Sample format
- #[clap(short = 'f', long, value_enum)]
+ #[arg(short = 'f', long, value_enum)]
pub format: Option<SampleFormatArg>,
/// Audio frame rate (Hz)
- #[clap(short = 'r', long = "rate")]
+ #[arg(short = 'r', long = "rate")]
pub frame_rate: Option<u32>,
/// Capture from loopback device
- #[clap(long = "loopback", value_enum)]
+ #[arg(long = "loopback", value_enum)]
pub loopback_type: Option<LoopbackType>,
/// Type of the file. Defaults to file extension.
- #[clap(long = "file_type", value_enum)]
+ #[arg(long = "file_type", value_enum)]
pub file_type_option: Option<FileType>,
/// Duration of playing/recording action in seconds.
- #[clap(short = 'd', long = "duration")]
+ #[arg(short = 'd', long = "duration")]
pub duration_sec: Option<usize>,
/// Capture effects to enable.
- #[clap(long = "effects", value_parser = parse_hex_or_decimal)]
+ #[arg(long = "effects", value_parser = parse_hex_or_decimal)]
pub effects: Option<u32>,
}
@@ -150,16 +150,16 @@ impl AudioOptions {
#[derive(PartialEq, Debug, Copy, Clone, ValueEnum)]
pub enum SampleFormatArg {
- #[clap(name = "U8")]
+ #[value(name = "U8")]
U8,
- #[clap(name = "S16_LE")]
+ #[value(name = "S16_LE")]
S16LE,
- #[clap(name = "S24_LE")]
+ #[value(name = "S24_LE")]
S24LE,
- #[clap(name = "S32_LE")]
+ #[value(name = "S32_LE")]
S32LE,
}
@@ -178,53 +178,53 @@ impl SampleFormatArg {
#[derive(PartialEq, Debug, Subcommand)]
pub enum ControlCommand {
/// Get the system volume (0 - 100)
- #[clap(name = "get_volume")]
+ #[command(name = "get_volume")]
GetSystemVolume,
/// Set the system volume to VOLUME (0 - 100)
- #[clap(name = "set_volume")]
+ #[command(name = "set_volume")]
SetSystemVolume { volume: u32 },
/// Get the system mute state (true or false)
- #[clap(name = "get_mute")]
+ #[command(name = "get_mute")]
GetSystemMute,
/// Set the system mute state to MUTE (true or false)
- #[clap(name = "set_mute")]
+ #[command(name = "set_mute")]
SetSystemMute {
- #[clap(value_parser = bool::from_str, action = clap::ArgAction::Set)]
+ #[arg(value_parser = bool::from_str, action = clap::ArgAction::Set)]
mute: bool,
},
/// Print list of output devices
- #[clap(name = "list_output_devices")]
+ #[command(name = "list_output_devices")]
ListOutputDevices {
/// Print as JSON
- #[clap(long)]
+ #[arg(long)]
json: bool,
},
/// Print list of input devices
- #[clap(name = "list_input_devices")]
+ #[command(name = "list_input_devices")]
ListInputDevices {
/// Print as JSON
- #[clap(long)]
+ #[arg(long)]
json: bool,
},
/// Print list of output nodes
- #[clap(name = "list_output_nodes")]
+ #[command(name = "list_output_nodes")]
ListOutputNodes,
/// Print list of input nodes
- #[clap(name = "list_input_nodes")]
+ #[command(name = "list_input_nodes")]
ListInputNodes,
/// Print stream info, device info
- #[clap(name = "dump_audio_debug_info")]
+ #[command(name = "dump_audio_debug_info")]
DumpAudioDebugInfo {
/// Print as JSON
- #[clap(long)]
+ #[arg(long)]
json: bool,
},
}
diff --git a/cras/client/cras_tests/src/getter.rs b/cras/client/cras_tests/src/getter.rs
index 3b41aec2..c872e6ee 100644
--- a/cras/client/cras_tests/src/getter.rs
+++ b/cras/client/cras_tests/src/getter.rs
@@ -18,19 +18,19 @@ type Result<T> = std::result::Result<T, Error>;
#[derive(PartialEq, Debug, clap::Subcommand)]
pub enum GetCommand {
/// Get number of active streams
- #[clap(name = "num_active_streams")]
+ #[command(name = "num_active_streams")]
NumActiveStreams,
/// Get default output buffer size
- #[clap(name = "default_output_buffer_size")]
+ #[command(name = "default_output_buffer_size")]
DefaultOutputBufferSize,
/// Get current output volume (0 - 100)
- #[clap(name = "output_volume")]
+ #[command(name = "output_volume")]
OutputVolume,
/// Get DBus introspect xml for interface org.chromium.cras.Control
- #[clap(name = "control_introspect")]
+ #[command(name = "control_introspect")]
ControlIntrospect,
}
diff --git a/cras/client/cras_tests/src/setter.rs b/cras/client/cras_tests/src/setter.rs
index 3a6c0aec..a1226af8 100644
--- a/cras/client/cras_tests/src/setter.rs
+++ b/cras/client/cras_tests/src/setter.rs
@@ -25,10 +25,10 @@ type Result<T> = std::result::Result<T, Error>;
#[derive(PartialEq, Debug, clap::Subcommand)]
pub enum SetCommand {
/// Set output to the given VOLUME (0 - 100)
- #[clap(name = "output_volume")]
+ #[command(name = "output_volume")]
OutputVolume { volume: i32 },
- #[clap(name = "global_remix")]
+ #[command(name = "global_remix")]
GlobalRemix {
num_channels: u32,
/// Float array representing |num_channels| * |num_channels| matrix
@@ -36,16 +36,16 @@ pub enum SetCommand {
},
/// Sets the display rotation for the given node
- #[clap(name = "display_rotation")]
+ #[command(name = "display_rotation")]
DisplayRotation {
node_id: CrasIodevNodeId,
rotation: CrasScreenRotation,
},
/// Enable or disable using Floss as Bluetooth stack
- #[clap(name = "floss_enabled")]
+ #[command(name = "floss_enabled")]
FlossEnabled {
- #[clap(value_parser = bool::from_str, action = clap::ArgAction::Set)]
+ #[arg(value_parser = bool::from_str, action = clap::ArgAction::Set)]
enabled: bool,
},
}
diff --git a/rock/src/cosine.rs b/rock/src/cosine.rs
index 71231b7f..690ad67a 100644
--- a/rock/src/cosine.rs
+++ b/rock/src/cosine.rs
@@ -16,7 +16,7 @@ pub(crate) struct CosineCommand {
/// Path to the second WAVE file
b: PathBuf,
/// Delay of b in frames.
- #[clap(long, default_value = "0")]
+ #[arg(long, default_value = "0")]
delay: i32,
}
diff --git a/rules/cbindgen/src/main.rs b/rules/cbindgen/src/main.rs
index 1e066205..94fa25d2 100644
--- a/rules/cbindgen/src/main.rs
+++ b/rules/cbindgen/src/main.rs
@@ -36,22 +36,22 @@ fn include_guard(path: &str) -> String {
#[derive(Parser)]
struct Command {
- #[clap(long)]
+ #[arg(long)]
output: String,
- #[clap(long)]
+ #[arg(long)]
assume_output: Option<String>,
- #[clap(long)]
+ #[arg(long)]
with_src: Vec<String>,
- #[clap(long)]
+ #[arg(long)]
with_include: Vec<String>,
- #[clap(long)]
+ #[arg(long)]
with_sys_include: Vec<String>,
- #[clap(long, default_value = "2023")]
+ #[arg(long, default_value = "2023")]
copyright_year: u32,
}