chore: use #[non_exhaustive] instead of private unit field (#3320)

This commit is contained in:
Taiki Endo
2020-12-23 22:48:33 +09:00
committed by GitHub
parent 0deaeb8494
commit 575938d457
15 changed files with 43 additions and 55 deletions
+4 -5
View File
@@ -409,9 +409,8 @@ pub struct Builder {
}
/// An error when the number of bytes read is more than max frame length.
pub struct LengthDelimitedCodecError {
_priv: (),
}
#[non_exhaustive]
pub struct LengthDelimitedCodecError;
/// A codec for frames delimited by a frame head specifying their lengths.
///
@@ -496,7 +495,7 @@ impl LengthDelimitedCodec {
if n > self.builder.max_frame_len as u64 {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
LengthDelimitedCodecError { _priv: () },
LengthDelimitedCodecError,
));
}
@@ -586,7 +585,7 @@ impl Encoder<Bytes> for LengthDelimitedCodec {
if n > self.builder.max_frame_len {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
LengthDelimitedCodecError { _priv: () },
LengthDelimitedCodecError,
));
}