main: Fix clippy (needless_late_init) issue

warning: unneeded late initalization
   --> src/main.rs:134:5
    |
134 |     let mut app: App;
    |     ^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(clippy::needless_late_init)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
help: declare `app` here
    |
138 |     let mut app: App = App::new("cloud-hypervisor")
    |     ~~~~~~~~~~~~~~~~

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2022-01-07 10:47:01 +00:00 committed by Bo Chen
parent 70af81d755
commit 9c8f291b60

View File

@ -130,12 +130,7 @@ fn create_app<'a>(
default_memory: &'a str,
default_rng: &'a str,
) -> App<'a> {
#[cfg(target_arch = "x86_64")]
let mut app: App;
#[cfg(target_arch = "aarch64")]
let app: App;
app = App::new("cloud-hypervisor")
let app = App::new("cloud-hypervisor")
// 'BUILT_VERSION' is set by the build script 'build.rs' at
// compile time
.version(env!("BUILT_VERSION"))
@ -372,27 +367,23 @@ fn create_app<'a>(
);
#[cfg(target_arch = "x86_64")]
{
app = app.arg(
Arg::new("sgx-epc")
.long("sgx-epc")
.help(config::SgxEpcConfig::SYNTAX)
.takes_value(true)
.min_values(1)
.group("vm-config"),
);
}
let app = app.arg(
Arg::new("sgx-epc")
.long("sgx-epc")
.help(config::SgxEpcConfig::SYNTAX)
.takes_value(true)
.min_values(1)
.group("vm-config"),
);
#[cfg(feature = "tdx")]
{
app = app.arg(
Arg::new("tdx")
.long("tdx")
.help("TDX Support: firmware=<tdvf path>")
.takes_value(true)
.group("vm-config"),
);
}
let app = app.arg(
Arg::new("tdx")
.long("tdx")
.help("TDX Support: firmware=<tdvf path>")
.takes_value(true)
.group("vm-config"),
);
app
}