Clippy lint fixing
This commit is contained in:
@@ -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)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user