From 044eab53ff0c8ee23abfc208417ae42937adc39f Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Sat, 22 Oct 2022 20:04:52 -0700 Subject: [PATCH] Update clap --- bench/Cargo.toml | 2 +- bench/src/lib.rs | 8 ++++---- perf/Cargo.toml | 2 +- perf/src/bin/perf_server.rs | 4 ++-- quinn/Cargo.toml | 2 +- quinn/examples/client.rs | 2 +- quinn/examples/server.rs | 5 ++--- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/bench/Cargo.toml b/bench/Cargo.toml index 35a438ce1..059028865 100644 --- a/bench/Cargo.toml +++ b/bench/Cargo.toml @@ -13,7 +13,7 @@ hdrhistogram = { version = "7.2", default-features = false } quinn = { path = "../quinn" } rcgen = "0.10.0" rustls = { version = "0.21.0", default-features = false, features = ["quic"] } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4", features = ["derive"] } tokio = { version = "1.0.1", features = ["rt", "sync"] } tracing = "0.1.10" tracing-subscriber = { version = "0.3.0", default-features = false, features = ["env-filter", "fmt", "ansi", "time", "local-time"] } diff --git a/bench/src/lib.rs b/bench/src/lib.rs index 9061b2839..a02eae4e8 100644 --- a/bench/src/lib.rs +++ b/bench/src/lib.rs @@ -161,15 +161,15 @@ pub struct Opt { pub max_streams: usize, /// Number of bytes to transmit from server to client /// - /// This can use SI prefixes for sizes. E.g. 1M will transfer 1MiB, 10GiB + /// This can use SI prefixes for sizes. E.g. 1M will transfer 1MiB, 10G /// will transfer 10GiB. - #[clap(long, default_value = "1G", parse(try_from_str = parse_byte_size))] + #[clap(long, default_value = "1G", value_parser = parse_byte_size)] pub download_size: u64, /// Number of bytes to transmit from client to server /// - /// This can use SI prefixes for sizes. E.g. 1M will transfer 1MiB, 10GiB + /// This can use SI prefixes for sizes. E.g. 1M will transfer 1MiB, 10G /// will transfer 10GiB. - #[clap(long, default_value = "0", parse(try_from_str = parse_byte_size))] + #[clap(long, default_value = "0", value_parser = parse_byte_size)] pub upload_size: u64, /// Show connection stats the at the end of the benchmark #[clap(long = "stats")] diff --git a/perf/Cargo.toml b/perf/Cargo.toml index b8f92ab28..76e626fcf 100644 --- a/perf/Cargo.toml +++ b/perf/Cargo.toml @@ -23,7 +23,7 @@ serde = { version = "1.0", features = ["derive"], optional = true } serde_json = { version = "1.0", optional = true } socket2 = "0.5" webpki = "0.22" -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4", features = ["derive"] } tokio = { version = "1.0.1", features = ["rt", "macros", "signal", "net", "sync"] } tracing = "0.1.10" tracing-subscriber = { version = "0.3.0", default-features = false, features = ["env-filter", "fmt", "ansi", "time", "local-time"] } diff --git a/perf/src/bin/perf_server.rs b/perf/src/bin/perf_server.rs index 839173575..169ca65e4 100644 --- a/perf/src/bin/perf_server.rs +++ b/perf/src/bin/perf_server.rs @@ -15,10 +15,10 @@ struct Opt { #[clap(long = "listen", default_value = "[::]:4433")] listen: SocketAddr, /// TLS private key in DER format - #[clap(parse(from_os_str), short = 'k', long = "key", requires = "cert")] + #[clap(short = 'k', long = "key", requires = "cert")] key: Option, /// TLS certificate in PEM format - #[clap(parse(from_os_str), short = 'c', long = "cert", requires = "key")] + #[clap(short = 'c', long = "cert", requires = "key")] cert: Option, /// Send buffer size in bytes #[clap(long, default_value = "2097152")] diff --git a/quinn/Cargo.toml b/quinn/Cargo.toml index 178420c56..ec90e5e08 100644 --- a/quinn/Cargo.toml +++ b/quinn/Cargo.toml @@ -56,7 +56,7 @@ directories-next = "2" rand = "0.8" rcgen = "0.10.0" rustls-pemfile = "1.0.0" -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4", features = ["derive"] } tokio = { version = "1.28.1", features = ["rt", "rt-multi-thread", "time", "macros", "sync"] } tracing-subscriber = { version = "0.3.0", default-features = false, features = ["env-filter", "fmt", "ansi", "time", "local-time"] } tracing-futures = { version = "0.2.0", default-features = false, features = ["std-future"] } diff --git a/quinn/examples/client.rs b/quinn/examples/client.rs index 85e69a3d5..8344a0459 100644 --- a/quinn/examples/client.rs +++ b/quinn/examples/client.rs @@ -33,7 +33,7 @@ struct Opt { host: Option, /// Custom certificate authority to trust, in DER format - #[clap(parse(from_os_str), long = "ca")] + #[clap(long = "ca")] ca: Option, /// Simulate NAT rebinding after connecting diff --git a/quinn/examples/server.rs b/quinn/examples/server.rs index 037cdab45..70e71be77 100644 --- a/quinn/examples/server.rs +++ b/quinn/examples/server.rs @@ -24,13 +24,12 @@ struct Opt { #[clap(long = "keylog")] keylog: bool, /// directory to serve files from - #[clap(parse(from_os_str))] root: PathBuf, /// TLS private key in PEM format - #[clap(parse(from_os_str), short = 'k', long = "key", requires = "cert")] + #[clap(short = 'k', long = "key", requires = "cert")] key: Option, /// TLS certificate in PEM format - #[clap(parse(from_os_str), short = 'c', long = "cert", requires = "key")] + #[clap(short = 'c', long = "cert", requires = "key")] cert: Option, /// Enable stateless retries #[clap(long = "stateless-retry")]