Skip to content

Commit 063929a

Browse files
committed
Clean up SerdePspEntrySourceValue Deserialize handling.
1 parent 327b663 commit 063929a

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

ahib-config/src/lib.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,21 +170,22 @@ impl<'de> serde::de::Deserialize<'de> for SerdePspEntrySourceValue {
170170
where
171171
A: serde::de::MapAccess<'de>,
172172
{
173-
while let Some(key) = map.next_key::<String>()? {
174-
if key == "PspSoftFuseChain" {
175-
let value = map.next_value::<PspSoftFuseChain>()?;
176-
return Ok(SerdePspEntrySourceValue::PspSoftFuseChain(
177-
value,
178-
));
179-
} else {
180-
return Err(serde::de::Error::custom(
173+
if let Some(key) = map.next_key::<String>()? {
174+
match key.as_str() {
175+
"PspSoftFuseChain" => {
176+
Ok(SerdePspEntrySourceValue::PspSoftFuseChain(
177+
map.next_value::<PspSoftFuseChain>()?,
178+
))
179+
}
180+
_ => Err(serde::de::Error::custom(
181181
"expected SerdePspEntrySourceValue variant",
182-
));
182+
)),
183183
}
184+
} else {
185+
Err(serde::de::Error::custom(
186+
"expected SerdePspEntrySourceValue variant",
187+
))
184188
}
185-
Err(serde::de::Error::custom(
186-
"expected SerdePspEntrySourceValue variant",
187-
))
188189
}
189190
}
190191

0 commit comments

Comments
 (0)