Remove filter_maps
All checks were successful
/ lint (push) Successful in 3m19s

This commit is contained in:
Tom Bloor 2024-04-05 00:24:08 +01:00
parent 57cd19ded7
commit ebbc05cd11
Signed by: TBSliver
GPG key ID: 4657C7EBE42CC5CC

View file

@ -45,11 +45,10 @@ impl CoreConfig {
let quest_config: QuestConfig = let quest_config: QuestConfig =
serde_json::from_str(rest.pop_front().ok_or("No Quest Config")?)?; serde_json::from_str(rest.pop_front().ok_or("No Quest Config")?)?;
let area_configs: Vec<AreaConfig> = rest let area_configs = rest
.iter() .iter()
.map(|s| serde_json::from_str(s)) .map(|s| serde_json::from_str(s))
.filter_map(|s| s.ok()) .collect::<Result<Vec<AreaConfig>, _>>()?;
.collect();
if rest.len() != area_configs.len() { if rest.len() != area_configs.len() {
return Err("Failed Parsing Area Configs".into()); return Err("Failed Parsing Area Configs".into());
@ -67,12 +66,11 @@ impl CoreConfig {
pub(crate) fn to_string(&self) -> Result<String, Box<dyn Error>> { pub(crate) fn to_string(&self) -> Result<String, Box<dyn Error>> {
let game_config = serde_json::to_string(&self.game_config)?; let game_config = serde_json::to_string(&self.game_config)?;
let area_config: Vec<String> = self let area_config = self
.area_configs .area_configs
.iter() .iter()
.map(|a| serde_json::to_string(a)) .map(|a| serde_json::to_string(a))
.filter_map(|a| a.ok()) .collect::<Result<Vec<String>, _>>()?;
.collect();
let rest_config = [ let rest_config = [
serde_json::to_string(&self.player_config)?, serde_json::to_string(&self.player_config)?,