diff --git a/src/any.rs b/src/any.rs index 913553f..9f325d0 100644 --- a/src/any.rs +++ b/src/any.rs @@ -103,7 +103,7 @@ macro_rules! any { }, }; - if body.has_remaining() { + if (cfg!(feature = "strict") || cfg!(test)) && body.has_remaining() { return Err(Error::UnderDecode(header.kind)); } diff --git a/src/atom.rs b/src/atom.rs index 7c1b4b2..d544231 100644 --- a/src/atom.rs +++ b/src/atom.rs @@ -63,7 +63,7 @@ impl DecodeMaybe for T { Err(err) => return Err(err), }; - if body.has_remaining() { + if (cfg!(feature = "strict") || cfg!(test)) && body.has_remaining() { return Err(Error::UnderDecode(T::KIND)); } @@ -95,7 +95,7 @@ impl ReadFrom for Option { Err(err) => return Err(err), }; - if body.has_remaining() { + if (cfg!(feature = "strict") || cfg!(test)) && body.has_remaining() { return Err(Error::UnderDecode(T::KIND)); } @@ -142,7 +142,7 @@ impl DecodeAtom for T { Err(err) => return Err(err), }; - if body.has_remaining() { + if (cfg!(feature = "strict") || cfg!(test)) && body.has_remaining() { return Err(Error::UnderDecode(T::KIND)); } diff --git a/src/tokio/atom.rs b/src/tokio/atom.rs index 0c57acc..ce63db5 100644 --- a/src/tokio/atom.rs +++ b/src/tokio/atom.rs @@ -37,7 +37,7 @@ impl AsyncReadFrom for Option { Err(err) => return Err(err), }; - if buf.has_remaining() { + if (cfg!(feature = "strict") || cfg!(test)) && buf.has_remaining() { return Err(Error::UnderDecode(T::KIND)); }