Skip to content

Commit

Permalink
Merge pull request #3531 from mulkieran/clippy-dumpmetadata
Browse files Browse the repository at this point in the history
Start running clippy on stratis-dumpmetadata
  • Loading branch information
mulkieran authored Jan 6, 2024
2 parents 38f40fa + 3f06238 commit c2c2e1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 4 additions & 6 deletions src/bin/stratis-dumpmetadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,13 @@ fn print_pool_metadata(pool_metadata: &Option<Vec<u8>>, 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(())
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c2c2e1c

Please sign in to comment.