Clippy lint fixing

This commit is contained in:
2026-05-14 15:31:48 +01:00
parent 7b9d52e94d
commit a55053dc97
5 changed files with 67 additions and 55 deletions
+4 -4
View File
@@ -32,20 +32,20 @@ pub struct Character
shoes: String,
}
pub async fn character_parse(archive: &mut ZipArchive<File>)
pub fn character_parse(archive: &mut ZipArchive<File>)
-> Result<Arc<Mutex<HashMap<String, Character>>>,String>
{
// Get the JSON file to a string
let mut characters_file = archive.by_name("characters.json")
.map_err (|err| format!("Unable to read story file: {}",err))?;
.map_err (|err| format!("Unable to read story file: {err}"))?;
let mut file_contents = String::new();
characters_file.read_to_string(&mut file_contents)
.map_err (|err| format!("Unable to read story file to string: {}",err))?;
.map_err (|err| format!("Unable to read story file to string: {err}"))?;
// Serialise this to a HashMap
let characters: HashMap<String, Character> =
serde_json::from_str(&file_contents)
.expect("JSON was not well-formatted");
debug!("{:?}",characters);
debug!("{characters:?}");
Ok(Arc::new(Mutex::new(characters)))
}