From 77edd8e54457925f278014a4ee6cb628b1ebc9cf Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Mon, 18 Jan 2016 13:07:30 -0800 Subject: [PATCH] fix(clippy): Switch to using or_else when we get a str parse error --- serde/src/de/impls.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs index 8c7565da..1e5f5770 100644 --- a/serde/src/de/impls.rs +++ b/serde/src/de/impls.rs @@ -154,7 +154,9 @@ impl< fn visit_str(&mut self, v: &str) -> Result 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)) + }) } }