Skip to content

Commit 01de903

Browse files
authored
fix: deprecated #[clap] attributes with #[arg] and #[command]
This PR updates deprecated #[clap(...)] attributes to their modern equivalents in clap 4.x. The current codebase still uses outdated syntax that has been deprecated since version 4.0. Pull-Request: #5930.
1 parent 1164fd3 commit 01de903

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

examples/autonat/src/bin/autonat_client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ use libp2p::{
3434
use tracing_subscriber::EnvFilter;
3535

3636
#[derive(Debug, Parser)]
37-
#[clap(name = "libp2p autonat")]
37+
#[command(name = "libp2p autonat")]
3838
struct Opt {
39-
#[clap(long)]
39+
#[arg(long)]
4040
listen_port: Option<u16>,
4141

42-
#[clap(long)]
42+
#[arg(long)]
4343
server_address: Multiaddr,
4444

45-
#[clap(long)]
45+
#[arg(long)]
4646
server_peer_id: PeerId,
4747
}
4848

examples/autonat/src/bin/autonat_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ use libp2p::{
3434
use tracing_subscriber::EnvFilter;
3535

3636
#[derive(Debug, Parser)]
37-
#[clap(name = "libp2p autonat")]
37+
#[command(name = "libp2p autonat")]
3838
struct Opt {
39-
#[clap(long)]
39+
#[arg(long)]
4040
listen_port: Option<u16>,
4141
}
4242

examples/autonatv2/src/bin/autonatv2_client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ use rand::rngs::OsRng;
1414
use tracing_subscriber::EnvFilter;
1515

1616
#[derive(Debug, Parser)]
17-
#[clap(name = "libp2p autonatv2 client")]
17+
#[command(name = "libp2p autonatv2 client")]
1818
struct Opt {
1919
/// Port where the client will listen for incoming connections.
20-
#[clap(short = 'p', long, default_value_t = 0)]
20+
#[arg(short = 'p', long, default_value_t = 0)]
2121
listen_port: u16,
2222

2323
/// Address of the server where want to connect to.
24-
#[clap(short = 'a', long)]
24+
#[arg(short = 'a', long)]
2525
server_address: Multiaddr,
2626

2727
/// Probe interval in seconds.
28-
#[clap(short = 't', long, default_value = "2")]
28+
#[arg(short = 't', long, default_value = "2")]
2929
probe_interval: u64,
3030
}
3131

0 commit comments

Comments
 (0)