diff --git a/src/main.rs b/src/main.rs index 279138e..c054ec3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -96,20 +96,16 @@ fn main() { // create necessary variables let ver = TransformVersion::Version1; - // StartData and TypeData are always present // ENCODE: StartData - StartData(ver) - .encode(ver, &mut out) - .unwrap(); + StartData(ver).encode(ver, &mut out).unwrap(); // ENCODE: TypeData TypeData(ItemType::from(loaded_config.item_type)) .encode(ver, &mut out) .unwrap(); - // ENCODE: ALotOfStuff // Also print any mapped errors if let Err(e) = cook( @@ -124,15 +120,10 @@ fn main() { }; // ENCODE: EndData - EndData - .encode(ver, &mut out) - .unwrap(); + EndData.encode(ver, &mut out).unwrap(); // final string print println!("{}", encode_string(&out)); - - - } Err(e) => println!("{}", e), } @@ -144,9 +135,14 @@ fn main() { } } } -fn cook(debug_mode: &bool, json_config: Jsonconfig, idsmap: HashMap, json_shiny: Vec, out: &mut Vec, ver: TransformVersion) -> Result<(), Errorfr> { - - +fn cook( + debug_mode: &bool, + json_config: Jsonconfig, + idsmap: HashMap, + json_shiny: Vec, + out: &mut Vec, + ver: TransformVersion, +) -> Result<(), Errorfr> { // ENCODE: NameData NameData(json_config.name.trim().to_string()) .encode(ver, out) @@ -218,7 +214,6 @@ fn cook(debug_mode: &bool, json_config: Jsonconfig, idsmap: HashMap, .encode(ver, out) .unwrap(); - if let Some(rerollcount) = json_config.rerolls { if rerollcount != 0 { // ENCODE: RerollData if applicable @@ -259,13 +254,12 @@ fn cook(debug_mode: &bool, json_config: Jsonconfig, idsmap: HashMap, // prints (Water,6) 255 times // println!("{:?}",vec![(Powders::WATER, 6); 255]); - Ok(()) } fn load_jsonconfig(path: &String) -> Result { - serde_json::from_reader(fs::File::open(path).map_err(|_| Errorfr::ItemJsonMissing)?) - .map_err(Errorfr::ItemJsonCorrupt) + serde_json::from_reader(fs::File::open(path).map_err(|_| Errorfr::ItemJsonMissing)?) + .map_err(Errorfr::ItemJsonCorrupt) } fn load_idkeys(executable_path: &str) -> Result, Errorfr> { // id_keys.json @@ -282,4 +276,4 @@ fn load_shinystats(executable_path: &str) -> Result, Errorfr> { .map_err(|_| Errorfr::ShinyJsonMissing)?, ) .map_err(|_| Errorfr::ShinyJsonCorrupt) -} \ No newline at end of file +}