diff options
| author | troido <troido@protonmail.com> | 2020-09-24 09:38:18 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-09-24 09:38:18 +0200 |
| commit | 523a635dc88bc7890a0e1d3c062a8165259761d6 (patch) | |
| tree | 56b0e379349250ecbf75eda6ccdb1f6f791dcbb1 /src/item.rs | |
| parent | daaf3a25e9c6cc1843b0a3aff71d4142f83dde10 (diff) | |
don't try to read into the json data structure all manually
Diffstat (limited to 'src/item.rs')
| -rw-r--r-- | src/item.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/item.rs b/src/item.rs index 88fd583..0abf35d 100644 --- a/src/item.rs +++ b/src/item.rs @@ -52,8 +52,8 @@ impl ItemAction { "eat" => Eat(arg.as_i64()?), "build" => Build( Template::from_json(arg.get(0)?).ok()?, - arg.get(1)?.as_array()?.iter().map(|v| Flag::from_str(v.as_str()?)).collect::<Option<HashSet<Flag>>>()?, - arg.get(2)?.as_array()?.iter().map(|v| Flag::from_str(v.as_str()?)).collect::<Option<HashSet<Flag>>>()? + arg.get(1)?.as_array()?.iter().map(|v| Flag::from_str(v.as_str()?).ok()).collect::<Option<HashSet<Flag>>>()?, + arg.get(2)?.as_array()?.iter().map(|v| Flag::from_str(v.as_str()?).ok()).collect::<Option<HashSet<Flag>>>()? ), "none" => None, "equip" => Equip(Equippable::from_json(arg)?), |
