fix(primitives): skip nonempty invariant check (#506)

This commit is contained in:
Harper 2024-08-25 15:44:35 +01:00 committed by GitHub
parent f5ebe71a08
commit 7aa510389b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -256,11 +256,11 @@ where
let items: Result<Vec<_>, _> = d.map_iter_with::<C, K, V>(ctx)?.collect();
let items = items?;
if items.is_empty() {
return Err(Error::message(
"decoding empty map as NonEmptyKeyValuePairs",
));
}
// if items.is_empty() {
// return Err(Error::message(
// "decoding empty map as NonEmptyKeyValuePairs",
// ));
// }
match datatype {
minicbor::data::Type::Map => Ok(NonEmptyKeyValuePairs::Def(items)),
@ -771,9 +771,9 @@ where
let inner: Vec<T> = d.decode_with(ctx)?;
if inner.is_empty() {
return Err(Error::message("decoding empty set as NonEmptySet"));
}
// if inner.is_empty() {
// return Err(Error::message("decoding empty set as NonEmptySet"));
// }
Ok(Self(inner))
}