diff --git a/src/structs.rs b/src/structs.rs index 3ef2304..51e647d 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -99,14 +99,13 @@ mod helpers { /// The input string here is either a number or two numbers separated by `SEPARATOR`. pub fn de_position<'de, D>(deserializer: D) -> Result, D::Error> where D: de::Deserializer<'de> { - if let Ok(s) = String::deserialize(deserializer) { - let mut ints = s.split(SEPARATOR).map(u16::from_str); - if let Some(Ok(n)) = ints.next() { - return Ok(Some(Position { - item_position: n, - total_items: ints.next().and_then(Result::ok), - })); - } + let s = String::deserialize(deserializer)?; + let mut ints = s.split(SEPARATOR).map(u16::from_str); + if let Some(Ok(n)) = ints.next() { + return Ok(Some(Position { + item_position: n, + total_items: ints.next().and_then(Result::ok), + })); } Ok(None) }