From f37029be790247ab2fd020fac8185efe8c3cdb73 Mon Sep 17 00:00:00 2001 From: Emanuel Pilz Date: Sat, 19 Oct 2024 12:33:33 +0200 Subject: [PATCH] revert null deserialization & format code --- ciborium/src/de/mod.rs | 2 +- ciborium/src/simple.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ciborium/src/de/mod.rs b/ciborium/src/de/mod.rs index f783da6..680a04e 100644 --- a/ciborium/src/de/mod.rs +++ b/ciborium/src/de/mod.rs @@ -212,7 +212,7 @@ where Header::Simple(simple::FALSE) => self.deserialize_bool(visitor), Header::Simple(simple::TRUE) => self.deserialize_bool(visitor), - Header::Simple(simple::NULL) => visitor.visit_none(), + Header::Simple(simple::NULL) => self.deserialize_option(visitor), Header::Simple(_) => self.recurse(|me| { let mut simple_de = crate::simple::SimpleDeserializer::<_, Self>::new(&mut me.decoder); diff --git a/ciborium/src/simple.rs b/ciborium/src/simple.rs index d84ef8b..4abafc4 100644 --- a/ciborium/src/simple.rs +++ b/ciborium/src/simple.rs @@ -27,7 +27,8 @@ where #[inline] fn deserialize_any>(self, visitor: V) -> Result { let offset = self.decoder.offset(); - let Header::Simple(simple) = self.decoder.pull()? else{ + + let Header::Simple(simple) = self.decoder.pull()? else { return Err(crate::de::Error::semantic(offset, "expected simple")); }; visitor.visit_u8(simple)