From 3f0623802716fc6cff5caee5d0cc6a5b47c58f98 Mon Sep 17 00:00:00 2001 From: mulhern Date: Fri, 5 Jan 2024 21:40:19 -0500 Subject: [PATCH] Start running clippy on stratis-dumpmetadata Fix a few clippy errors that crept in. Signed-off-by: mulhern --- Makefile | 1 + src/bin/stratis-dumpmetadata.rs | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 2e257b7830..d0bb1d7806 100644 --- a/Makefile +++ b/Makefile @@ -458,6 +458,7 @@ clippy-macros: clippy-min: RUSTFLAGS="${DENY}" cargo clippy ${CLIPPY_OPTS} ${MIN_FEATURES} -- ${CLIPPY_DENY} ${CLIPPY_PEDANTIC} ${CLIPPY_PEDANTIC_USELESS} RUSTFLAGS="${DENY}" cargo clippy ${CLIPPY_OPTS} ${SYSTEMD_FEATURES} -- ${CLIPPY_DENY} ${CLIPPY_PEDANTIC} ${CLIPPY_PEDANTIC_USELESS} + RUSTFLAGS="${DENY}" cargo clippy ${CLIPPY_OPTS} ${EXTRAS_FEATURES} -- ${CLIPPY_DENY} ${CLIPPY_PEDANTIC} ${CLIPPY_PEDANTIC_USELESS} ## Run clippy on the udev utils clippy-udev-utils: diff --git a/src/bin/stratis-dumpmetadata.rs b/src/bin/stratis-dumpmetadata.rs index d34c446173..4bb29a728d 100644 --- a/src/bin/stratis-dumpmetadata.rs +++ b/src/bin/stratis-dumpmetadata.rs @@ -100,15 +100,13 @@ fn print_pool_metadata(pool_metadata: &Option>, only_pool: bool) -> Resu println!("\nPool metadata:"); } if let Some(loaded_state) = pool_metadata { - let state_json: Value = serde_json::from_slice(&loaded_state) + let state_json: Value = serde_json::from_slice(loaded_state) .map_err(|extract_err| format!("Error during state JSON extract: {}", extract_err))?; let state_json_pretty: String = serde_json::to_string_pretty(&state_json) .map_err(|parse_err| format!("Error during state JSON parse: {}", parse_err))?; println!("{}", state_json_pretty); - } else { - if !only_pool { - println!("None found"); - } + } else if !only_pool { + println!("None found"); } Ok(()) @@ -136,7 +134,7 @@ fn initialize_log() { fn run(devpath: &str, print_bytes: bool, pool_only: bool) -> Result<(), String> { let mut devfile = OpenOptions::new() .read(true) - .open(&devpath) + .open(devpath) .map_err(|the_io_error| format!("Error opening device: {}", the_io_error))?; let read_results = StaticHeader::read_sigblocks(&mut devfile);