From 0389190c64b2a09a6faf4d8ebe6b7a66fa6cad54 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Fri, 6 Jan 2023 16:45:47 +0000 Subject: [PATCH] build: drop the need to import macros from Clap Signed-off-by: Wei Liu --- performance-metrics/Cargo.toml | 2 +- performance-metrics/src/main.rs | 4 +--- src/bin/ch-remote.rs | 5 +---- src/main.rs | 4 +--- vhost_user_block/Cargo.toml | 2 +- vhost_user_block/src/main.rs | 6 ++---- vhost_user_net/src/main.rs | 7 ++----- 7 files changed, 9 insertions(+), 21 deletions(-) diff --git a/performance-metrics/Cargo.toml b/performance-metrics/Cargo.toml index cb96b6676..166d43c68 100644 --- a/performance-metrics/Cargo.toml +++ b/performance-metrics/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" build = "build.rs" [dependencies] -clap = { version = "4.0.29", features = ["wrap_help","cargo"] } +clap = { version = "4.0.29", features = ["wrap_help"] } dirs = "4.0.0" serde = { version = "1.0.151", features = ["rc", "derive"] } serde_json = "1.0.89" diff --git a/performance-metrics/src/main.rs b/performance-metrics/src/main.rs index fa804553d..667e1e4af 100644 --- a/performance-metrics/src/main.rs +++ b/performance-metrics/src/main.rs @@ -5,8 +5,6 @@ // Custom harness to run performance tests extern crate test_infra; -#[macro_use(crate_authors)] -extern crate clap; mod performance_tests; @@ -631,7 +629,7 @@ fn date() -> String { fn main() { let cmd_arguments = ClapCommand::new("performance-metrics") .version(env!("GIT_HUMAN_READABLE")) - .author(crate_authors!()) + .author(env!("CARGO_PKG_AUTHORS")) .about("Generate the performance metrics data for Cloud Hypervisor") .arg( Arg::new("test-filter") diff --git a/src/bin/ch-remote.rs b/src/bin/ch-remote.rs index 9620846d7..ec709d8b6 100644 --- a/src/bin/ch-remote.rs +++ b/src/bin/ch-remote.rs @@ -3,9 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 // -#[macro_use(crate_authors)] -extern crate clap; - use api_client::simple_api_command; use api_client::simple_api_command_with_fds; use api_client::simple_api_full_command; @@ -506,7 +503,7 @@ fn do_command(matches: &ArgMatches) -> Result<(), Error> { fn main() { let app = Command::new("ch-remote") - .author(crate_authors!()) + .author(env!("CARGO_PKG_AUTHORS")) .subcommand_required(true) .about("Remotely control a cloud-hypervisor VMM.") .arg( diff --git a/src/main.rs b/src/main.rs index e30540cdf..e0b59a961 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,8 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 // -#[macro_use(crate_authors)] -extern crate clap; #[macro_use] extern crate event_monitor; @@ -130,7 +128,7 @@ fn create_app(default_vcpus: String, default_memory: String, default_rng: String // 'BUILT_VERSION' is set by the build script 'build.rs' at // compile time .version(env!("BUILT_VERSION")) - .author(crate_authors!()) + .author(env!("CARGO_PKG_AUTHORS")) .about("Launch a cloud-hypervisor VMM.") .group(ArgGroup::new("vm-config").multiple(true)) .group(ArgGroup::new("vmm-config").multiple(true)) diff --git a/vhost_user_block/Cargo.toml b/vhost_user_block/Cargo.toml index beccaea24..24956ae27 100644 --- a/vhost_user_block/Cargo.toml +++ b/vhost_user_block/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] block_util = { path = "../block_util" } -clap = { version = "4.0.29", features = ["wrap_help","cargo"] } +clap = { version = "4.0.29", features = ["wrap_help"] } env_logger = "0.10.0" epoll = "4.3.1" libc = "0.2.139" diff --git a/vhost_user_block/src/main.rs b/vhost_user_block/src/main.rs index 9f03aabe2..2d7d68556 100644 --- a/vhost_user_block/src/main.rs +++ b/vhost_user_block/src/main.rs @@ -8,8 +8,6 @@ // // SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause) -#[macro_use(crate_version, crate_authors)] -extern crate clap; extern crate vhost_user_block; use clap::{Arg, Command}; @@ -19,8 +17,8 @@ fn main() { env_logger::init(); let cmd_arguments = Command::new("vhost-user-blk backend") - .version(crate_version!()) - .author(crate_authors!()) + .version(env!("CARGO_PKG_VERSION")) + .author(env!("CARGO_PKG_AUTHORS")) .about("Launch a vhost-user-blk backend.") .arg( Arg::new("block-backend") diff --git a/vhost_user_net/src/main.rs b/vhost_user_net/src/main.rs index 25aa29c69..f9dc813e4 100644 --- a/vhost_user_net/src/main.rs +++ b/vhost_user_net/src/main.rs @@ -6,9 +6,6 @@ // // SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause) -#[macro_use(crate_version, crate_authors)] -extern crate clap; - use clap::{Arg, Command}; use vhost_user_net::start_net_backend; @@ -16,8 +13,8 @@ fn main() { env_logger::init(); let cmd_arguments = Command::new("vhost-user-net backend") - .version(crate_version!()) - .author(crate_authors!()) + .version(env!("CARGO_PKG_VERSION")) + .author(env!("CARGO_PKG_AUTHORS")) .about("Launch a vhost-user-net backend.") .arg( Arg::new("net-backend")