fix clippy stuff
This commit is contained in:
parent
db78cdaf30
commit
41610c51ca
1 changed files with 30 additions and 45 deletions
75
src/main.rs
75
src/main.rs
|
@ -77,12 +77,12 @@ fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// check if files load properly and all that
|
// check if files load properly and all that
|
||||||
if let Some(T) = &args.config {
|
if let Some(t) = &args.config {
|
||||||
match load_idkeys(executable_path) {
|
match load_idkeys(executable_path) {
|
||||||
Ok(loaded_idkeys) => {
|
Ok(loaded_idkeys) => {
|
||||||
match load_shinystats(executable_path) {
|
match load_shinystats(executable_path) {
|
||||||
Ok(loaded_shinystats) => {
|
Ok(loaded_shinystats) => {
|
||||||
match load_jsonconfig(T) {
|
match load_jsonconfig(t) {
|
||||||
Ok(loaded_config) => {
|
Ok(loaded_config) => {
|
||||||
// debug mode on if in the loaded config
|
// debug mode on if in the loaded config
|
||||||
if let Some(debugconfig) = loaded_config.debug {
|
if let Some(debugconfig) = loaded_config.debug {
|
||||||
|
@ -134,17 +134,17 @@ fn main() {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Err(E) => println!("{}", E),
|
Err(e) => println!("{}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(E) => println!("{}", E),
|
Err(e) => println!("{}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(E) => println!("{}", E),
|
Err(e) => println!("{}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn cook(mut debug_mode: &bool, json_config: Jsonconfig, idsmap: HashMap<String, u8>, json_shiny: Vec<Shinystruct>, out: &mut Vec<u8>, ver: TransformVersion) -> Result<(), Errorfr> {
|
fn cook(debug_mode: &bool, json_config: Jsonconfig, idsmap: HashMap<String, u8>, json_shiny: Vec<Shinystruct>, out: &mut Vec<u8>, ver: TransformVersion) -> Result<(), Errorfr> {
|
||||||
|
|
||||||
|
|
||||||
// ENCODE: NameData
|
// ENCODE: NameData
|
||||||
|
@ -199,14 +199,14 @@ fn cook(mut debug_mode: &bool, json_config: Jsonconfig, idsmap: HashMap<String,
|
||||||
'a' => Element::Air,
|
'a' => Element::Air,
|
||||||
_ => Element::Thunder,
|
_ => Element::Thunder,
|
||||||
};
|
};
|
||||||
if debug_mode {
|
if *debug_mode {
|
||||||
dbg!(powdertier);
|
dbg!(powdertier);
|
||||||
dbg!(eletype);
|
dbg!(eletype);
|
||||||
}
|
}
|
||||||
powdervec.push(Some((eletype, powdertier)));
|
powdervec.push(Some((eletype, powdertier)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if debug_mode {
|
if *debug_mode {
|
||||||
dbg!(&powdervec);
|
dbg!(&powdervec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,17 +218,15 @@ fn cook(mut debug_mode: &bool, json_config: Jsonconfig, idsmap: HashMap<String,
|
||||||
.encode(ver, out)
|
.encode(ver, out)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
match json_config.rerolls {
|
|
||||||
Some(rerollcount) => {
|
if let Some(rerollcount) = json_config.rerolls {
|
||||||
if rerollcount != 0 {
|
if rerollcount != 0 {
|
||||||
// ENCODE: RerollData if applicable
|
// ENCODE: RerollData if applicable
|
||||||
RerollData(rerollcount).encode(ver, out).unwrap();
|
RerollData(rerollcount).encode(ver, out).unwrap();
|
||||||
if debug_mode {
|
if *debug_mode {
|
||||||
dbg!(rerollcount);
|
dbg!(rerollcount);
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
None => {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut realshinykey: u8;
|
let mut realshinykey: u8;
|
||||||
|
@ -239,12 +237,12 @@ fn cook(mut debug_mode: &bool, json_config: Jsonconfig, idsmap: HashMap<String,
|
||||||
for i in json_shiny {
|
for i in json_shiny {
|
||||||
if i.key == shiny.key {
|
if i.key == shiny.key {
|
||||||
realshinykey = i.id;
|
realshinykey = i.id;
|
||||||
if debug_mode {
|
if *debug_mode {
|
||||||
dbg!(&shiny.key);
|
dbg!(&shiny.key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if debug_mode {
|
if *debug_mode {
|
||||||
dbg!(&realshinykey);
|
dbg!(&realshinykey);
|
||||||
dbg!(&shinyvalue);
|
dbg!(&shinyvalue);
|
||||||
}
|
}
|
||||||
|
@ -266,35 +264,22 @@ fn cook(mut debug_mode: &bool, json_config: Jsonconfig, idsmap: HashMap<String,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_jsonconfig(path: &String) -> Result<Jsonconfig, Errorfr> {
|
fn load_jsonconfig(path: &String) -> Result<Jsonconfig, Errorfr> {
|
||||||
Ok(
|
|
||||||
serde_json::from_reader(fs::File::open(path).map_err(|_| Errorfr::ItemJsonMissing)?)
|
serde_json::from_reader(fs::File::open(path).map_err(|_| Errorfr::ItemJsonMissing)?)
|
||||||
.map_err(Errorfr::ItemJsonCorrupt)?,
|
.map_err(Errorfr::ItemJsonCorrupt)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
fn load_idkeys(executable_path: &str) -> Result<HashMap<String, u8>, Errorfr> {
|
fn load_idkeys(executable_path: &str) -> Result<HashMap<String, u8>, Errorfr> {
|
||||||
Ok(
|
// id_keys.json
|
||||||
// id_keys.json
|
serde_json::from_reader(
|
||||||
serde_json::from_reader(
|
fs::File::open(executable_path.to_owned() + "/id_keys.json")
|
||||||
fs::File::open(executable_path.to_owned() + "/id_keys.json")
|
.map_err(|_| Errorfr::IDMapJsonMissing)?,
|
||||||
.map_err(|_| Errorfr::IDMapJsonMissing)?,
|
|
||||||
)
|
|
||||||
.map_err(|_| Errorfr::IDMapJsonCorrupt)?,
|
|
||||||
)
|
)
|
||||||
|
.map_err(|_| Errorfr::IDMapJsonCorrupt)
|
||||||
}
|
}
|
||||||
fn load_shinystats(executable_path: &str) -> Result<Vec<Shinystruct>, Errorfr> {
|
fn load_shinystats(executable_path: &str) -> Result<Vec<Shinystruct>, Errorfr> {
|
||||||
Ok(
|
// shiny_stats.json
|
||||||
// shiny_stats.json
|
serde_json::from_reader(
|
||||||
serde_json::from_reader(
|
fs::File::open(executable_path.to_owned() + "/shiny_stats.json")
|
||||||
fs::File::open(executable_path.to_owned() + "/shiny_stats.json")
|
.map_err(|_| Errorfr::ShinyJsonMissing)?,
|
||||||
.map_err(|_| Errorfr::ShinyJsonMissing)?,
|
|
||||||
)
|
|
||||||
.map_err(|_| Errorfr::ShinyJsonCorrupt)?,
|
|
||||||
)
|
)
|
||||||
}
|
.map_err(|_| Errorfr::ShinyJsonCorrupt)
|
||||||
|
}
|
||||||
fn somer() -> Option<u8> {
|
|
||||||
Some(1)
|
|
||||||
}
|
|
||||||
fn oker() -> Result<u8, String> {
|
|
||||||
Ok(2)
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue