@@ -102,13 +102,8 @@ impl<'i, E: Encoding> Decoder<'i, E> {
102
102
///
103
103
/// # Returns
104
104
/// - `Ok(bytes)` if the expected amount of data was read
105
- /// - `Err(Error::InvalidLength)` if the exact amount of data couldn't be read, or
106
- /// if the output buffer has a length of 0
105
+ /// - `Err(Error::InvalidLength)` if the exact amount of data couldn't be read
107
106
pub fn decode < ' o > ( & mut self , out : & ' o mut [ u8 ] ) -> Result < & ' o [ u8 ] , Error > {
108
- if out. is_empty ( ) {
109
- return Err ( InvalidLength ) ;
110
- }
111
-
112
107
if self . is_finished ( ) {
113
108
return Err ( InvalidLength ) ;
114
109
}
@@ -551,8 +546,6 @@ impl<'i> Iterator for LineReader<'i> {
551
546
mod tests {
552
547
use crate :: { Base64 , Base64Unpadded , Decoder , alphabet:: Alphabet , test_vectors:: * } ;
553
548
554
- #[ cfg( feature = "std" ) ]
555
- use crate :: Error :: InvalidLength ;
556
549
#[ cfg( feature = "std" ) ]
557
550
use { alloc:: vec:: Vec , std:: io:: Read } ;
558
551
@@ -598,16 +591,6 @@ mod tests {
598
591
assert_eq ! ( buf. as_slice( ) , MULTILINE_PADDED_BIN ) ;
599
592
}
600
593
601
- #[ cfg( feature = "std" ) ]
602
- #[ test]
603
- fn reject_empty_read ( ) {
604
- let mut decoder = Decoder :: < Base64 > :: new ( b"AAAA" ) . unwrap ( ) ;
605
-
606
- let mut buf: Vec < u8 > = vec ! [ ] ;
607
-
608
- assert_eq ! ( decoder. decode( & mut buf) , Err ( InvalidLength ) ) ;
609
- }
610
-
611
594
/// Core functionality of a decoding test
612
595
#[ allow( clippy:: arithmetic_side_effects) ]
613
596
fn decode_test < ' a , F , V > ( expected : & [ u8 ] , f : F )
0 commit comments