resolved pedantic clippy warnings

This commit is contained in:
Vomitblood 2024-04-22 10:46:02 +08:00
parent 1568bcb094
commit 825dc966c3
4 changed files with 12 additions and 12 deletions

View file

@ -13,7 +13,7 @@ fn main() {
let mut rng = SmallRng::from_entropy();
if let Some(random_file) = files.choose(&mut rng) {
println!("{}", random_file);
println!("{random_file}");
if let Some(file_data) = ColorScriptsDir::get(random_file) {
println!("{}", std::str::from_utf8(file_data.data.as_ref()).unwrap());
}

View file

@ -30,7 +30,7 @@ fn main() {
// display selections
println!("Extract destination: {}", extract_destination.display());
println!("Verbose: {}", verbose);
println!("Verbose: {verbose}");
// invoke bigchungus fetch function
rustmon::fetch::fetch(extract_destination, verbose)
@ -44,9 +44,9 @@ fn main() {
if pokemon_name.is_empty() {
// list
match rustmon::list::print_pokemon_list() {
Ok(_) => {}
Ok(()) => {}
Err(e) => {
eprintln!("Error: {}", e);
eprintln!("Error: {e}");
std::process::exit(1);
}
}
@ -55,7 +55,7 @@ fn main() {
match rustmon::list::print_pokemon_forms(pokemon_name) {
Ok(_) => {}
Err(e) => {
eprintln!("Error: {}", e);
eprintln!("Error: {e}");
std::process::exit(1);
}
}

View file

@ -26,7 +26,9 @@ pub fn print(
random_lite().unwrap();
} else {
// convert list of names to list of pokedex numbers
let pokedexes = if !names[0].is_empty() {
let pokedexes = if names[0].is_empty() {
pokedexes.clone()
} else {
let mut pokedexes: Vec<u16> = Vec::new();
for name in names {
match find_pokedex_by_pokemon(name) {
@ -38,8 +40,6 @@ pub fn print(
}
}
pokedexes
} else {
pokedexes.clone()
};
// process the pokedexes list
@ -182,7 +182,7 @@ fn process_forms_list(pokedexes: &[u16], forms: Vec<&String>) -> Vec<String> {
// consider using crate::list::print_pokemon_forms(pokemon_name)
println!("Available forms for {}:", pokemon.name);
for available_form in &pokemon.forms {
println!(" - {}", available_form);
println!(" - {available_form}");
}
std::process::exit(1);
}
@ -223,7 +223,7 @@ fn slug_generator(big: bool, form: String, name: String, shiny_rate: f32) -> std
path.push(crate::constants::DATA_DIRECTORY.join("colorscripts"));
path.push(&big);
path.push(shiny_directory);
path.push(format!("{}{}", name, form));
path.push(format!("{name}{form}"));
path
}

View file

@ -2,7 +2,7 @@ pub fn validate_files() {
match validate_pokemon_json() {
Ok(_) => {}
Err(e) => {
eprintln!("Error: {}", e);
eprintln!("Error: {e}");
std::process::exit(1);
}
};
@ -10,7 +10,7 @@ pub fn validate_files() {
match validate_colorscripts_directory() {
Ok(_) => {}
Err(e) => {
eprintln!("Error: {}", e);
eprintln!("Error: {e}");
std::process::exit(1);
}
};