diff --git a/testool/src/statetest/yaml.rs b/testool/src/statetest/yaml.rs
index 7654632911..867e6b5423 100644
--- a/testool/src/statetest/yaml.rs
+++ b/testool/src/statetest/yaml.rs
@@ -290,28 +290,21 @@ impl<'a> YamlStateTestBuilder<'a> {
}
/// returns the element as an address
fn parse_address(yaml: &Yaml) -> Result
{
- if let Some(as_str) = yaml.as_str() {
- parse::parse_address(as_str)
- } else if let Some(as_i64) = yaml.as_i64() {
- let hex = format!("{as_i64:0>40}");
- Ok(Address::from_slice(&hex::decode(hex)?))
- } else if let Yaml::Real(as_real) = yaml {
- Ok(Address::from_str(as_real)?)
- } else {
- bail!("cannot parse address {yaml:?}");
+ match yaml {
+ Yaml::Real(real) => Ok(Address::from_str(real)?),
+ Yaml::Integer(int) => {
+ let hex = format!("{int:0>40}");
+ Ok(Address::from_slice(&hex::decode(hex)?))
+ }
+ Yaml::String(str) => parse::parse_address(str),
+ _ => bail!("cannot parse address {yaml:?}"),
}
}
/// returns the element as a to address
fn parse_to_address(yaml: &Yaml) -> Result