File tree Expand file tree Collapse file tree 1 file changed +1
-8
lines changed Expand file tree Collapse file tree 1 file changed +1
-8
lines changed Original file line number Diff line number Diff line change @@ -454,10 +454,6 @@ impl Message {
454454 /// Converts a `MESSAGE_SIZE`-byte slice to a message object
455455 #[ inline]
456456 pub fn from_slice ( data : & [ u8 ] ) -> Result < Message , Error > {
457- if data == [ 0 ; constants:: MESSAGE_SIZE ] {
458- return Err ( Error :: InvalidMessage ) ;
459- }
460-
461457 match data. len ( ) {
462458 constants:: MESSAGE_SIZE => {
463459 let mut ret = [ 0 ; constants:: MESSAGE_SIZE ] ;
@@ -1007,10 +1003,7 @@ mod tests {
10071003 Err ( InvalidMessage ) ) ;
10081004 assert_eq ! ( Message :: from_slice( & [ 0 ; constants:: MESSAGE_SIZE + 1 ] ) ,
10091005 Err ( InvalidMessage ) ) ;
1010- assert_eq ! (
1011- Message :: from_slice( & [ 0 ; constants:: MESSAGE_SIZE ] ) ,
1012- Err ( InvalidMessage )
1013- ) ;
1006+ assert ! ( Message :: from_slice( & [ 0 ; constants:: MESSAGE_SIZE ] ) . is_ok( ) ) ;
10141007 assert ! ( Message :: from_slice( & [ 1 ; constants:: MESSAGE_SIZE ] ) . is_ok( ) ) ;
10151008 }
10161009
You can’t perform that action at this time.
0 commit comments