diff --git a/2016/rust/src/day_11.rs b/2016/rust/src/day_11.rs index 5eb03e9..a1a0511 100644 --- a/2016/rust/src/day_11.rs +++ b/2016/rust/src/day_11.rs @@ -77,12 +77,12 @@ impl str::FromStr for Floor { impl<'a> TryFrom> for Item { type Err = Error; fn try_from(c: regex::Captures) -> Result { - let element = c.name("element").ok_or("")?; - let itemtype = c.name("itemtype").ok_or("")?; + let element = c.name("element").ok_or("missing element name")?; + let itemtype = c.name("itemtype").ok_or("missing item type")?; match itemtype { "generator" => Ok(Item::Generator(element.into())), "microchip" => Ok(Item::Microchip(element.into())), - _ => Err("".into()), + _ => Err(format!("unexpected item type: '{}'", itemtype).into()), } } }