Skip to content

Commit

Permalink
clippy and match dat behavior on the names
Browse files Browse the repository at this point in the history
  • Loading branch information
EclecticGriffin committed Nov 13, 2024
1 parent ed9c05e commit 88410db
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions tools/cider-data-converter/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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<String>,
#[argh(default = "String::from(DAT_EXTENSION)")]
file_extension: String,
}

fn main() -> Result<(), CiderDataConverterError> {
Expand Down Expand Up @@ -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
)),
)?);

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 88410db

Please sign in to comment.