From 88410db791de6728a086d9a39482eba071e73851 Mon Sep 17 00:00:00 2001 From: Griffin Berlstein Date: Wed, 13 Nov 2024 15:23:18 -0500 Subject: [PATCH] clippy and match `dat` behavior on the names --- tools/cider-data-converter/src/main.rs | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/tools/cider-data-converter/src/main.rs b/tools/cider-data-converter/src/main.rs index 6685fbba1..a95d910e8 100644 --- a/tools/cider-data-converter/src/main.rs +++ b/tools/cider-data-converter/src/main.rs @@ -4,7 +4,6 @@ use cider_data_converter::{ }; use core::str; use interp::serialization::{self, DataDump, SerializationError}; -use itertools::Itertools; use std::{ fs::File, io::{self, BufRead, BufReader, BufWriter, Read, Write}, @@ -104,9 +103,10 @@ struct Opts { use_quotes: bool, /// the file extension to use for the output/input file when parsing to and - /// from the dat target. If not provided, no extension will be used + /// from the dat target. If not provided, the extension is assumed to be .dat #[argh(option, short = 'e', long = "dat-file-extension")] - file_extension: Option, + #[argh(default = "String::from(DAT_EXTENSION)")] + file_extension: String, } fn main() -> Result<(), CiderDataConverterError> { @@ -170,12 +170,8 @@ fn main() -> Result<(), CiderDataConverterError> { let starting_len = data.len(); let mem_file = BufReader::new(File::open( path.join(format!( - "{}{}", - mem_dec.name, - opts.file_extension - .as_ref() - .map(|x| format!(".{}", x)) - .unwrap_or_default() + "{}.{}", + mem_dec.name, opts.file_extension )), )?); @@ -256,13 +252,9 @@ fn main() -> Result<(), CiderDataConverterError> { for memory in &data.header.memories { let file = File::create(path.join(format!( - "{}{}", - memory.name, - opts.file_extension - .as_ref() - .map(|x| format!(".{}", x)) - .unwrap_or_default() - )))?; + "{}.{}", + memory.name, opts.file_extension + )))?; let mut writer = BufWriter::new(file); for bytes in data .get_data(&memory.name)