fix(clippy): Switch to using or_else when we get a str parse error

This commit is contained in:
Erick Tryzelaar 2016-01-18 13:07:30 -08:00
parent 8087b7cec6
commit 77edd8e544

View File

@ -154,7 +154,9 @@ impl<
fn visit_str<E>(&mut self, v: &str) -> Result<T, E>
where E: Error,
{
str::FromStr::from_str(v.trim()).or(Err(Error::type_mismatch(Type::Str)))
str::FromStr::from_str(v.trim()).or_else(|_| {
Err(Error::type_mismatch(Type::Str))
})
}
}