mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-13 14:51:01 +00:00
fix(clippy): Switch to using or_else when we get a str parse error
This commit is contained in:
@@ -154,7 +154,9 @@ impl<
|
|||||||
fn visit_str<E>(&mut self, v: &str) -> Result<T, E>
|
fn visit_str<E>(&mut self, v: &str) -> Result<T, E>
|
||||||
where E: Error,
|
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))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user