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 {
454
454
/// Converts a `MESSAGE_SIZE`-byte slice to a message object
455
455
#[ inline]
456
456
pub fn from_slice ( data : & [ u8 ] ) -> Result < Message , Error > {
457
- if data == [ 0 ; constants:: MESSAGE_SIZE ] {
458
- return Err ( Error :: InvalidMessage ) ;
459
- }
460
-
461
457
match data. len ( ) {
462
458
constants:: MESSAGE_SIZE => {
463
459
let mut ret = [ 0 ; constants:: MESSAGE_SIZE ] ;
@@ -1007,10 +1003,7 @@ mod tests {
1007
1003
Err ( InvalidMessage ) ) ;
1008
1004
assert_eq ! ( Message :: from_slice( & [ 0 ; constants:: MESSAGE_SIZE + 1 ] ) ,
1009
1005
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( ) ) ;
1014
1007
assert ! ( Message :: from_slice( & [ 1 ; constants:: MESSAGE_SIZE ] ) . is_ok( ) ) ;
1015
1008
}
1016
1009
You can’t perform that action at this time.
0 commit comments