diff --git a/bee-api/bee-rest-api/src/routes/api/core/v2/white_flag.rs b/bee-api/bee-rest-api/src/routes/api/core/v2/white_flag.rs index 16348f14e2..5b8c2c9974 100644 --- a/bee-api/bee-rest-api/src/routes/api/core/v2/white_flag.rs +++ b/bee-api/bee-rest-api/src/routes/api/core/v2/white_flag.rs @@ -97,7 +97,7 @@ pub(crate) async fn white_flag( request_block( &*args.tangle, &args.block_requester, - &*args.requested_blocks, + &args.requested_blocks, *parent, index, ) diff --git a/bee-block/fuzz/fuzz_targets/fuzz_address.rs b/bee-block/fuzz/fuzz_targets/fuzz_address.rs index 365c2615e2..59f67b33b1 100644 --- a/bee-block/fuzz/fuzz_targets/fuzz_address.rs +++ b/bee-block/fuzz/fuzz_targets/fuzz_address.rs @@ -9,5 +9,5 @@ use libfuzzer_sys::fuzz_target; use packable::PackableExt; fuzz_target!(|data: &[u8]| { - let _ = Address::unpack_verified(&mut data.to_vec().as_slice()); + let _ = Address::unpack_verified(data.to_vec().as_slice()); }); diff --git a/bee-block/fuzz/fuzz_targets/fuzz_block.rs b/bee-block/fuzz/fuzz_targets/fuzz_block.rs index 9d9131bb9c..3fa0b530d7 100644 --- a/bee-block/fuzz/fuzz_targets/fuzz_block.rs +++ b/bee-block/fuzz/fuzz_targets/fuzz_block.rs @@ -9,5 +9,5 @@ use libfuzzer_sys::fuzz_target; use packable::PackableExt; fuzz_target!(|data: &[u8]| { - let _ = Block::unpack_strict(&mut data.to_vec().as_slice(), &()); + let _ = Block::unpack_strict(data.to_vec().as_slice(), &()); }); diff --git a/bee-block/fuzz/fuzz_targets/fuzz_feature.rs b/bee-block/fuzz/fuzz_targets/fuzz_feature.rs index ddc59113ca..914acd4b47 100644 --- a/bee-block/fuzz/fuzz_targets/fuzz_feature.rs +++ b/bee-block/fuzz/fuzz_targets/fuzz_feature.rs @@ -9,5 +9,5 @@ use libfuzzer_sys::fuzz_target; use packable::PackableExt; fuzz_target!(|data: &[u8]| { - let _ = Feature::unpack_verified(&mut data.to_vec().as_slice()); + let _ = Feature::unpack_verified(data.to_vec().as_slice()); }); diff --git a/bee-block/fuzz/fuzz_targets/fuzz_input.rs b/bee-block/fuzz/fuzz_targets/fuzz_input.rs index 87084469f2..8afbad2fed 100644 --- a/bee-block/fuzz/fuzz_targets/fuzz_input.rs +++ b/bee-block/fuzz/fuzz_targets/fuzz_input.rs @@ -9,5 +9,5 @@ use libfuzzer_sys::fuzz_target; use packable::PackableExt; fuzz_target!(|data: &[u8]| { - let _ = Input::unpack_verified(&mut data.to_vec().as_slice()); + let _ = Input::unpack_verified(data.to_vec().as_slice()); }); diff --git a/bee-block/fuzz/fuzz_targets/fuzz_output.rs b/bee-block/fuzz/fuzz_targets/fuzz_output.rs index 16e830597d..cdcde6c3b0 100644 --- a/bee-block/fuzz/fuzz_targets/fuzz_output.rs +++ b/bee-block/fuzz/fuzz_targets/fuzz_output.rs @@ -9,5 +9,5 @@ use libfuzzer_sys::fuzz_target; use packable::PackableExt; fuzz_target!(|data: &[u8]| { - let _ = Output::unpack_verified(&mut data.to_vec().as_slice()); + let _ = Output::unpack_verified(data.to_vec().as_slice()); }); diff --git a/bee-block/fuzz/fuzz_targets/fuzz_payload.rs b/bee-block/fuzz/fuzz_targets/fuzz_payload.rs index 4e40fd90ef..faa5790d87 100644 --- a/bee-block/fuzz/fuzz_targets/fuzz_payload.rs +++ b/bee-block/fuzz/fuzz_targets/fuzz_payload.rs @@ -9,5 +9,5 @@ use libfuzzer_sys::fuzz_target; use packable::PackableExt; fuzz_target!(|data: &[u8]| { - let _ = Payload::unpack_verified(&mut data.to_vec().as_slice()); + let _ = Payload::unpack_verified(data.to_vec().as_slice()); }); diff --git a/bee-block/fuzz/fuzz_targets/fuzz_signature.rs b/bee-block/fuzz/fuzz_targets/fuzz_signature.rs index 449cd15aa2..eb05b3c05c 100644 --- a/bee-block/fuzz/fuzz_targets/fuzz_signature.rs +++ b/bee-block/fuzz/fuzz_targets/fuzz_signature.rs @@ -9,5 +9,5 @@ use libfuzzer_sys::fuzz_target; use packable::PackableExt; fuzz_target!(|data: &[u8]| { - let _ = Signature::unpack_verified(&mut data.to_vec().as_slice()); + let _ = Signature::unpack_verified(data.to_vec().as_slice()); }); diff --git a/bee-block/fuzz/fuzz_targets/fuzz_unlock.rs b/bee-block/fuzz/fuzz_targets/fuzz_unlock.rs index ee5ed781c8..dd122510ee 100644 --- a/bee-block/fuzz/fuzz_targets/fuzz_unlock.rs +++ b/bee-block/fuzz/fuzz_targets/fuzz_unlock.rs @@ -9,5 +9,5 @@ use libfuzzer_sys::fuzz_target; use packable::PackableExt; fuzz_target!(|data: &[u8]| { - let _ = Unlock::unpack_verified(&mut data.to_vec().as_slice()); + let _ = Unlock::unpack_verified(data.to_vec().as_slice()); }); diff --git a/bee-block/fuzz/fuzz_targets/fuzz_unlock_condition.rs b/bee-block/fuzz/fuzz_targets/fuzz_unlock_condition.rs index 31ff3fb3b4..6d0b028c09 100644 --- a/bee-block/fuzz/fuzz_targets/fuzz_unlock_condition.rs +++ b/bee-block/fuzz/fuzz_targets/fuzz_unlock_condition.rs @@ -9,5 +9,5 @@ use libfuzzer_sys::fuzz_target; use packable::PackableExt; fuzz_target!(|data: &[u8]| { - let _ = UnlockCondition::unpack_verified(&mut data.to_vec().as_slice()); + let _ = UnlockCondition::unpack_verified(data.to_vec().as_slice()); }); diff --git a/bee-block/fuzz/src/fuzz_sorter.rs b/bee-block/fuzz/src/fuzz_sorter.rs index c54391e16d..11e1749144 100644 --- a/bee-block/fuzz/src/fuzz_sorter.rs +++ b/bee-block/fuzz/src/fuzz_sorter.rs @@ -24,7 +24,7 @@ fn main() -> io::Result<()> { file.read_to_end(&mut buffer)?; - if let Err(err) = Block::unpack_strict(&mut buffer.as_slice(), &()) { + if let Err(err) = Block::unpack_strict(buffer.as_slice(), &()) { if !matches!(err, UnpackError::Unpacker(..)) { let mut file = OpenOptions::new() .write(true) diff --git a/bee-block/tests/address.rs b/bee-block/tests/address.rs index 9282d34420..3716bc8b87 100644 --- a/bee-block/tests/address.rs +++ b/bee-block/tests/address.rs @@ -83,6 +83,6 @@ fn pack_unpack_valid_ed25519() { assert_eq!(address_packed.len(), address.packed_len()); assert_eq!( address, - PackableExt::unpack_verified(&mut address_packed.as_slice(), &()).unwrap() + PackableExt::unpack_verified(address_packed.as_slice(), &()).unwrap() ); } diff --git a/bee-block/tests/block.rs b/bee-block/tests/block.rs index c63018a31e..0ce76f3dfa 100644 --- a/bee-block/tests/block.rs +++ b/bee-block/tests/block.rs @@ -77,7 +77,7 @@ fn invalid_payload_kind() { fn unpack_valid_no_remaining_bytes() { assert!( Block::unpack_strict( - &mut vec![ + vec![ 2, 2, 140, 28, 186, 52, 147, 145, 96, 9, 105, 89, 78, 139, 3, 71, 249, 97, 149, 190, 63, 238, 168, 202, 82, 140, 227, 66, 173, 19, 110, 93, 117, 34, 225, 202, 251, 10, 156, 58, 144, 225, 54, 79, 62, 38, 20, 121, 95, 90, 112, 109, 6, 166, 126, 145, 13, 62, 52, 68, 248, 135, 223, 119, 137, 13, 0, 0, 0, 0, 21, @@ -94,7 +94,7 @@ fn unpack_valid_no_remaining_bytes() { fn unpack_invalid_remaining_bytes() { assert!(matches!( Block::unpack_strict( - &mut vec![ + vec![ 2, 2, 140, 28, 186, 52, 147, 145, 96, 9, 105, 89, 78, 139, 3, 71, 249, 97, 149, 190, 63, 238, 168, 202, 82, 140, 227, 66, 173, 19, 110, 93, 117, 34, 225, 202, 251, 10, 156, 58, 144, 225, 54, 79, 62, 38, 20, 121, 95, 90, 112, 109, 6, 166, 126, 145, 13, 62, 52, 68, 248, 135, 223, 119, 137, 13, 0, 0, 0, 0, 21, @@ -119,7 +119,7 @@ fn pack_unpack_valid() { assert_eq!(packed_block.len(), block.packed_len()); assert_eq!( block, - PackableExt::unpack_verified(&mut packed_block.as_slice(), &protocol_parameters).unwrap() + PackableExt::unpack_verified(packed_block.as_slice(), &protocol_parameters).unwrap() ); } diff --git a/bee-block/tests/block_id.rs b/bee-block/tests/block_id.rs index d4449fc0e4..e1cb4978bc 100644 --- a/bee-block/tests/block_id.rs +++ b/bee-block/tests/block_id.rs @@ -52,6 +52,6 @@ fn pack_unpack_valid() { assert_eq!(packed_block_id.len(), block_id.packed_len()); assert_eq!( block_id, - PackableExt::unpack_verified(&mut packed_block_id.as_slice(), &()).unwrap() + PackableExt::unpack_verified(packed_block_id.as_slice(), &()).unwrap() ); } diff --git a/bee-block/tests/ed25519_address.rs b/bee-block/tests/ed25519_address.rs index ce8743d3b5..fdc9e9028c 100644 --- a/bee-block/tests/ed25519_address.rs +++ b/bee-block/tests/ed25519_address.rs @@ -68,6 +68,6 @@ fn pack_unpack_valid() { assert_eq!( address, - PackableExt::unpack_verified(&mut packed_address.as_slice(), &()).unwrap() + PackableExt::unpack_verified(packed_address.as_slice(), &()).unwrap() ); } diff --git a/bee-block/tests/ed25519_signature.rs b/bee-block/tests/ed25519_signature.rs index 84c497b9dc..29d0c422da 100644 --- a/bee-block/tests/ed25519_signature.rs +++ b/bee-block/tests/ed25519_signature.rs @@ -29,8 +29,5 @@ fn pack_unpack_valid() { let sig = Ed25519Signature::new(pub_key_bytes, sig_bytes); let sig_packed = sig.pack_to_vec(); - assert_eq!( - sig, - PackableExt::unpack_verified(&mut sig_packed.as_slice(), &()).unwrap() - ); + assert_eq!(sig, PackableExt::unpack_verified(sig_packed.as_slice(), &()).unwrap()); } diff --git a/bee-block/tests/migrated_funds_entry.rs b/bee-block/tests/migrated_funds_entry.rs index 7bbbeaf10d..6352ea89b8 100644 --- a/bee-block/tests/migrated_funds_entry.rs +++ b/bee-block/tests/migrated_funds_entry.rs @@ -67,7 +67,7 @@ fn pack_unpack_valid() { protocol_parameters.token_supply(), ) .unwrap(); - let mfe_2 = MigratedFundsEntry::unpack_verified(&mut mfe_1.pack_to_vec().as_slice(), &protocol_parameters).unwrap(); + let mfe_2 = MigratedFundsEntry::unpack_verified(mfe_1.pack_to_vec().as_slice(), &protocol_parameters).unwrap(); assert_eq!(mfe_1.tail_transaction_hash(), mfe_2.tail_transaction_hash()); assert_eq!(*mfe_1.address(), *mfe_2.address()); @@ -85,7 +85,7 @@ fn pack_unpack_invalid_amount() { ]; assert!(matches!( - MigratedFundsEntry::unpack_verified(&mut bytes.as_slice(), &protocol_parameters), + MigratedFundsEntry::unpack_verified(bytes.as_slice(), &protocol_parameters), Err(UnpackError::Packable(Error::InvalidMigratedFundsEntryAmount( 3_038_287_259_199_220_266 ))) diff --git a/bee-block/tests/milestone_id.rs b/bee-block/tests/milestone_id.rs index f1c747f496..1a2c72a524 100644 --- a/bee-block/tests/milestone_id.rs +++ b/bee-block/tests/milestone_id.rs @@ -54,6 +54,6 @@ fn pack_unpack_valid() { assert_eq!(packed_milestone_id.len(), milestone_id.packed_len()); assert_eq!( milestone_id, - PackableExt::unpack_verified(&mut packed_milestone_id.as_slice(), &()).unwrap() + PackableExt::unpack_verified(packed_milestone_id.as_slice(), &()).unwrap() ); } diff --git a/bee-block/tests/milestone_index.rs b/bee-block/tests/milestone_index.rs index 9e08f92ee4..af8c3d2250 100644 --- a/bee-block/tests/milestone_index.rs +++ b/bee-block/tests/milestone_index.rs @@ -18,7 +18,7 @@ fn display_impl() { fn unpack() { let packed = 0u32.pack_to_vec(); assert_eq!( - MilestoneIndex::unpack_verified(&mut packed.as_slice(), &()).unwrap(), + MilestoneIndex::unpack_verified(packed.as_slice(), &()).unwrap(), MilestoneIndex(0) ); } diff --git a/bee-block/tests/milestone_payload.rs b/bee-block/tests/milestone_payload.rs index 3e879457b8..c4918a80b5 100644 --- a/bee-block/tests/milestone_payload.rs +++ b/bee-block/tests/milestone_payload.rs @@ -140,7 +140,7 @@ fn pack_unpack_valid() { assert_eq!(payload.packed_len(), packed.len()); assert_eq!( payload, - PackableExt::unpack_verified(&mut packed.as_slice(), &protocol_parameters).unwrap() + PackableExt::unpack_verified(packed.as_slice(), &protocol_parameters).unwrap() ) } diff --git a/bee-block/tests/milestone_payload_essence.rs b/bee-block/tests/milestone_payload_essence.rs index 0d6f4551eb..5177167abf 100644 --- a/bee-block/tests/milestone_payload_essence.rs +++ b/bee-block/tests/milestone_payload_essence.rs @@ -136,7 +136,7 @@ fn pack_unpack_valid() { let packed = milestone_payload.pack_to_vec(); assert_eq!( - MilestoneEssence::unpack_verified(&mut packed.as_slice(), &protocol_parameters).unwrap(), + MilestoneEssence::unpack_verified(packed.as_slice(), &protocol_parameters).unwrap(), milestone_payload, ); } diff --git a/bee-block/tests/output_id.rs b/bee-block/tests/output_id.rs index feed536e43..cf9524ace8 100644 --- a/bee-block/tests/output_id.rs +++ b/bee-block/tests/output_id.rs @@ -102,7 +102,7 @@ fn packed_len() { #[test] fn pack_unpack_valid() { let output_id_1 = OutputId::from_str(OUTPUT_ID).unwrap(); - let output_id_2 = OutputId::unpack_verified(&mut output_id_1.pack_to_vec().as_slice(), &()).unwrap(); + let output_id_2 = OutputId::unpack_verified(output_id_1.pack_to_vec().as_slice(), &()).unwrap(); assert_eq!(output_id_1, output_id_2); } @@ -115,7 +115,7 @@ fn pack_unpack_invalid() { ]; assert!(matches!( - OutputId::unpack_verified(&mut bytes.as_slice(), &()), + OutputId::unpack_verified(bytes.as_slice(), &()), Err(UnpackError::Packable(Error::InvalidInputOutputIndex( InvalidBoundedU16(128) ))) diff --git a/bee-block/tests/parents.rs b/bee-block/tests/parents.rs index 0b1dca16c7..9f538a13dd 100644 --- a/bee-block/tests/parents.rs +++ b/bee-block/tests/parents.rs @@ -77,7 +77,7 @@ fn packed_len() { #[test] fn pack_unpack_valid() { let parents_1 = Parents::new(rand_block_ids(8)).unwrap(); - let parents_2 = Parents::unpack_verified(&mut parents_1.pack_to_vec().as_slice(), &()).unwrap(); + let parents_2 = Parents::unpack_verified(parents_1.pack_to_vec().as_slice(), &()).unwrap(); assert_eq!(parents_1, parents_2); } @@ -91,7 +91,7 @@ fn pack_unpack_invalid_less_than_min() { ]; assert!(matches!( - Parents::unpack_verified(&mut bytes.as_slice(), &()), + Parents::unpack_verified(bytes.as_slice(), &()), Err(UnpackError::Packable(Error::InvalidParentCount( TryIntoBoundedU8Error::Invalid(0) ))) @@ -107,7 +107,7 @@ fn pack_unpack_invalid_more_than_max() { ]; assert!(matches!( - Parents::unpack_verified(&mut bytes.as_slice(), &()), + Parents::unpack_verified(bytes.as_slice(), &()), Err(UnpackError::Packable(Error::InvalidParentCount( TryIntoBoundedU8Error::Invalid(9) ))) @@ -121,7 +121,7 @@ fn unpack_invalid_not_sorted() { let inner = VecPrefix::<_, u8>::try_from(inner).unwrap(); let packed = inner.pack_to_vec(); - let parents = Parents::unpack_verified(&mut packed.as_slice(), &()); + let parents = Parents::unpack_verified(packed.as_slice(), &()); assert!(matches!( parents, @@ -136,7 +136,7 @@ fn unpack_invalid_not_unique() { let inner = VecPrefix::<_, u8>::try_from(inner).unwrap(); let packed = inner.pack_to_vec(); - let parents = Parents::unpack_verified(&mut packed.as_slice(), &()); + let parents = Parents::unpack_verified(packed.as_slice(), &()); assert!(matches!( parents, diff --git a/bee-block/tests/payload.rs b/bee-block/tests/payload.rs index 927682acbd..a60b290b5a 100644 --- a/bee-block/tests/payload.rs +++ b/bee-block/tests/payload.rs @@ -71,7 +71,7 @@ fn transaction() { assert!(matches!(payload, Payload::Transaction(_))); assert_eq!( payload, - PackableExt::unpack_verified(&mut packed.as_slice(), &protocol_parameters).unwrap() + PackableExt::unpack_verified(packed.as_slice(), &protocol_parameters).unwrap() ); } @@ -103,7 +103,7 @@ fn milestone() { assert!(matches!(payload, Payload::Milestone(_))); assert_eq!( payload, - PackableExt::unpack_verified(&mut packed.as_slice(), &protocol_parameters).unwrap() + PackableExt::unpack_verified(packed.as_slice(), &protocol_parameters).unwrap() ); } @@ -135,6 +135,6 @@ fn treasury_transaction() { assert!(matches!(payload, Payload::TreasuryTransaction(_))); assert_eq!( payload, - PackableExt::unpack_verified(&mut packed.as_slice(), &protocol_parameters).unwrap() + PackableExt::unpack_verified(packed.as_slice(), &protocol_parameters).unwrap() ); } diff --git a/bee-block/tests/receipt_milestone_option.rs b/bee-block/tests/receipt_milestone_option.rs index d5980a7ccb..30bcf6c1be 100644 --- a/bee-block/tests/receipt_milestone_option.rs +++ b/bee-block/tests/receipt_milestone_option.rs @@ -204,7 +204,7 @@ fn pack_unpack_valid() { assert_eq!(packed_receipt.len(), receipt.packed_len()); assert_eq!( receipt, - PackableExt::unpack_verified(&mut packed_receipt.as_slice(), &protocol_parameters).unwrap() + PackableExt::unpack_verified(packed_receipt.as_slice(), &protocol_parameters).unwrap() ); } diff --git a/bee-block/tests/reference_unlock.rs b/bee-block/tests/reference_unlock.rs index 7e489a63b3..3c5f16785a 100644 --- a/bee-block/tests/reference_unlock.rs +++ b/bee-block/tests/reference_unlock.rs @@ -51,7 +51,7 @@ fn packed_len() { #[test] fn pack_unpack_valid() { let reference_1 = ReferenceUnlock::try_from(42).unwrap(); - let reference_2 = ReferenceUnlock::unpack_verified(&mut reference_1.pack_to_vec().as_slice(), &()).unwrap(); + let reference_2 = ReferenceUnlock::unpack_verified(reference_1.pack_to_vec().as_slice(), &()).unwrap(); assert_eq!(reference_1, reference_2); } @@ -59,7 +59,7 @@ fn pack_unpack_valid() { #[test] fn pack_unpack_invalid_index() { assert!(matches!( - ReferenceUnlock::unpack_verified(&mut vec![0x2a, 0x2a].as_slice(), &()), + ReferenceUnlock::unpack_verified(vec![0x2a, 0x2a].as_slice(), &()), Err(UnpackError::Packable(Error::InvalidReferenceIndex(InvalidBoundedU16( 10794 )))) diff --git a/bee-block/tests/signature_unlock.rs b/bee-block/tests/signature_unlock.rs index 4f0b8ef7dd..f6339ed2dd 100644 --- a/bee-block/tests/signature_unlock.rs +++ b/bee-block/tests/signature_unlock.rs @@ -59,7 +59,7 @@ fn pack_unpack_valid_ed25519() { rand_bytes(64).try_into().unwrap(), ))); let signature_bytes = signature_1.pack_to_vec(); - let signature_2 = SignatureUnlock::unpack_verified(&mut signature_bytes.as_slice(), &()).unwrap(); + let signature_2 = SignatureUnlock::unpack_verified(signature_bytes.as_slice(), &()).unwrap(); assert_eq!(signature_bytes[0], 0); assert_eq!(signature_1, signature_2); @@ -69,7 +69,7 @@ fn pack_unpack_valid_ed25519() { fn pack_unpack_invalid_kind() { assert!(matches!( SignatureUnlock::unpack_verified( - &mut vec![ + vec![ 1, 111, 225, 221, 28, 247, 253, 234, 110, 187, 52, 129, 153, 130, 84, 26, 7, 226, 27, 212, 145, 96, 151, 196, 124, 135, 176, 31, 48, 0, 213, 200, 82, 227, 169, 21, 179, 253, 115, 184, 209, 107, 138, 0, 62, 252, 20, 255, 24, 193, 203, 255, 137, 142, 158, 25, 171, 86, 195, 20, 70, 56, 136, 204, 2, 219, diff --git a/bee-block/tests/tagged_data_payload.rs b/bee-block/tests/tagged_data_payload.rs index 20b8e518cb..50933d4b41 100644 --- a/bee-block/tests/tagged_data_payload.rs +++ b/bee-block/tests/tagged_data_payload.rs @@ -79,7 +79,7 @@ fn packed_len() { fn pack_unpack_valid() { let tagged_data_1 = TaggedDataPayload::new(rand_bytes(32), vec![0x42, 0xff, 0x84, 0xa2, 0x42, 0xff, 0x84, 0xa2]).unwrap(); - let tagged_data_2 = TaggedDataPayload::unpack_verified(&mut tagged_data_1.pack_to_vec().as_slice(), &()).unwrap(); + let tagged_data_2 = TaggedDataPayload::unpack_verified(tagged_data_1.pack_to_vec().as_slice(), &()).unwrap(); assert_eq!(tagged_data_1.tag(), tagged_data_2.tag()); assert_eq!(tagged_data_1.data(), tagged_data_2.data()); @@ -87,8 +87,7 @@ fn pack_unpack_valid() { #[test] fn unpack_valid_tag_length_min() { - let payload = - TaggedDataPayload::unpack_verified(&mut vec![0x00, 0x00, 0x00, 0x00, 0x00, 0x00].as_slice(), &()).unwrap(); + let payload = TaggedDataPayload::unpack_verified(vec![0x00, 0x00, 0x00, 0x00, 0x00, 0x00].as_slice(), &()).unwrap(); assert!(payload.tag().is_empty()); } @@ -97,7 +96,7 @@ fn unpack_valid_tag_length_min() { fn unpack_invalid_tag_length_more_than_max() { assert!(matches!( TaggedDataPayload::unpack_verified( - &mut vec![ + vec![ 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -116,7 +115,7 @@ fn unpack_invalid_tag_length_more_than_max() { #[test] fn unpack_invalid_data_length_more_than_max() { assert!(matches!( - TaggedDataPayload::unpack_verified(&mut vec![0x02, 0x00, 0x00, 0x35, 0x82, 0x00, 0x00].as_slice(), &()), + TaggedDataPayload::unpack_verified(vec![0x02, 0x00, 0x00, 0x35, 0x82, 0x00, 0x00].as_slice(), &()), Err(UnpackError::Packable(Error::InvalidTaggedDataLength( TryIntoBoundedU32Error::Invalid(33333) ))) diff --git a/bee-block/tests/tail_transaction_hash.rs b/bee-block/tests/tail_transaction_hash.rs index ed328d21ed..fec032d8fe 100644 --- a/bee-block/tests/tail_transaction_hash.rs +++ b/bee-block/tests/tail_transaction_hash.rs @@ -61,7 +61,7 @@ fn packed_len() { fn pack_unpack_valid() { let tth_1 = TailTransactionHash::try_from(HASH_BYTES).unwrap(); let tth_1_bytes = tth_1.pack_to_vec(); - let tth_2 = TailTransactionHash::unpack_verified(&mut tth_1_bytes.as_slice(), &()).unwrap(); + let tth_2 = TailTransactionHash::unpack_verified(tth_1_bytes.as_slice(), &()).unwrap(); assert_eq!(tth_1, tth_2); } @@ -75,7 +75,7 @@ fn pack_unpack_invalid() { ]; assert!(matches!( - TailTransactionHash::unpack_verified(&mut bytes.as_slice(), &()), + TailTransactionHash::unpack_verified(bytes.as_slice(), &()), Err(UnpackError::Packable(Error::InvalidTailTransactionHash)) )); } diff --git a/bee-block/tests/transaction_essence.rs b/bee-block/tests/transaction_essence.rs index c6c45b434b..c30e5bad0b 100644 --- a/bee-block/tests/transaction_essence.rs +++ b/bee-block/tests/transaction_essence.rs @@ -45,7 +45,7 @@ fn essence_kind() { #[test] fn essence_unpack_invalid_kind() { assert!(matches!( - TransactionEssence::unpack_verified(&mut vec![2u8; 32].as_slice(), &protocol_parameters()), + TransactionEssence::unpack_verified(vec![2u8; 32].as_slice(), &protocol_parameters()), Err(UnpackError::Packable(Error::InvalidEssenceKind(2))) )); } diff --git a/bee-block/tests/transaction_id.rs b/bee-block/tests/transaction_id.rs index 81802fa42b..89a8de3633 100644 --- a/bee-block/tests/transaction_id.rs +++ b/bee-block/tests/transaction_id.rs @@ -44,6 +44,6 @@ fn pack_unpack_valid() { assert_eq!( transaction_id, - PackableExt::unpack_verified(&mut packed_transaction_id.as_slice(), &()).unwrap() + PackableExt::unpack_verified(packed_transaction_id.as_slice(), &()).unwrap() ); } diff --git a/bee-block/tests/transaction_payload.rs b/bee-block/tests/transaction_payload.rs index f9a7828c09..36e0cc78f8 100644 --- a/bee-block/tests/transaction_payload.rs +++ b/bee-block/tests/transaction_payload.rs @@ -143,7 +143,7 @@ fn pack_unpack_valid() { assert_eq!(packed_tx_payload.len(), tx_payload.packed_len()); assert_eq!( tx_payload, - PackableExt::unpack_verified(&mut packed_tx_payload.as_slice(), &protocol_parameters).unwrap() + PackableExt::unpack_verified(packed_tx_payload.as_slice(), &protocol_parameters).unwrap() ); } diff --git a/bee-block/tests/treasury_input.rs b/bee-block/tests/treasury_input.rs index 17f90269aa..4777a80c24 100644 --- a/bee-block/tests/treasury_input.rs +++ b/bee-block/tests/treasury_input.rs @@ -67,7 +67,7 @@ fn packed_len() { #[test] fn pack_unpack_valid() { let input_1 = TreasuryInput::new(MilestoneId::from_str(MILESTONE_ID_VALID).unwrap()); - let input_2 = TreasuryInput::unpack_verified(&mut input_1.pack_to_vec().as_slice(), &()).unwrap(); + let input_2 = TreasuryInput::unpack_verified(input_1.pack_to_vec().as_slice(), &()).unwrap(); assert_eq!(input_1, input_2); } diff --git a/bee-block/tests/treasury_output.rs b/bee-block/tests/treasury_output.rs index c128153aa2..120355b6d8 100644 --- a/bee-block/tests/treasury_output.rs +++ b/bee-block/tests/treasury_output.rs @@ -50,8 +50,7 @@ fn packed_len() { #[test] fn pack_unpack_valid() { let output_1 = TreasuryOutput::new(1_000, protocol_parameters().token_supply()).unwrap(); - let output_2 = - TreasuryOutput::unpack_verified(&mut output_1.pack_to_vec().as_slice(), &protocol_parameters()).unwrap(); + let output_2 = TreasuryOutput::unpack_verified(output_1.pack_to_vec().as_slice(), &protocol_parameters()).unwrap(); assert_eq!(output_1, output_2); } @@ -60,7 +59,7 @@ fn pack_unpack_valid() { fn pack_unpack_invalid() { assert!(matches!( TreasuryOutput::unpack_verified( - &mut vec![0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a].as_slice(), + vec![0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a].as_slice(), &protocol_parameters() ), Err(UnpackError::Packable(Error::InvalidTreasuryOutputAmount( diff --git a/bee-block/tests/treasury_transaction_payload.rs b/bee-block/tests/treasury_transaction_payload.rs index 0ddd21a3a7..ef0e8a1ad6 100644 --- a/bee-block/tests/treasury_transaction_payload.rs +++ b/bee-block/tests/treasury_transaction_payload.rs @@ -46,7 +46,7 @@ fn pack_unpack_valid() { ) .unwrap(); let transaction_2 = - TreasuryTransactionPayload::unpack_verified(&mut transaction_1.pack_to_vec().as_slice(), &protocol_parameters) + TreasuryTransactionPayload::unpack_verified(transaction_1.pack_to_vec().as_slice(), &protocol_parameters) .unwrap(); assert_eq!(transaction_1, transaction_2); @@ -62,5 +62,5 @@ fn pack_unpack_invalid() { // Actual error is not checked because the output type check is done after the output is parsed so the error is not // `InvalidOutputKind` but something related to an invalid address, so not really relevant for this test. - assert!(TreasuryTransactionPayload::unpack_verified(&mut bytes.as_slice(), &protocol_parameters()).is_err()); + assert!(TreasuryTransactionPayload::unpack_verified(bytes.as_slice(), &protocol_parameters()).is_err()); } diff --git a/bee-block/tests/utxo_input.rs b/bee-block/tests/utxo_input.rs index c869aad8b9..bb65965118 100644 --- a/bee-block/tests/utxo_input.rs +++ b/bee-block/tests/utxo_input.rs @@ -67,7 +67,7 @@ fn packed_len() { fn pack_unpack() { let output_id = OutputId::from_str(OUTPUT_ID).unwrap(); let input_1 = UtxoInput::new(*output_id.transaction_id(), output_id.index()).unwrap(); - let input_2 = UtxoInput::unpack_verified(&mut input_1.pack_to_vec().as_slice(), &()).unwrap(); + let input_2 = UtxoInput::unpack_verified(input_1.pack_to_vec().as_slice(), &()).unwrap(); assert_eq!(input_1, input_2); } diff --git a/bee-protocol/bee-protocol/src/block/processor.rs b/bee-protocol/bee-protocol/src/block/processor.rs index 9ce543a808..dea2130bf4 100644 --- a/bee-protocol/bee-protocol/src/block/processor.rs +++ b/bee-protocol/bee-protocol/src/block/processor.rs @@ -112,7 +112,7 @@ where { trace!("Processing received block..."); - let block = match Block::unpack_strict(&mut &block_packet.bytes[..], &protocol_parameters) { + let block = match Block::unpack_strict(&block_packet.bytes[..], &protocol_parameters) { Ok(block) => block, Err(e) => { notify_invalid_block(format!("Invalid block: {:?}.", e), &metrics, notifier); @@ -149,7 +149,7 @@ where if let Some(ref peer_id) = from { peer_manager .get_map(peer_id, |peer| { - (*peer).0.metrics().known_blocks_inc(); + peer.0.metrics().known_blocks_inc(); }) .unwrap_or_default(); } @@ -179,7 +179,7 @@ where metrics.blocks_average_latency_set(latency_sum / latency_num); for parent in block.parents().iter() { - request_block(&tangle, &block_requester, &*requested_blocks, *parent, index).await; + request_block(&tangle, &block_requester, &requested_blocks, *parent, index).await; } } // Block was not requested. diff --git a/bee-protocol/bee-protocol/src/peer/manager.rs b/bee-protocol/bee-protocol/src/peer/manager.rs index 4a88a35640..f505978029 100644 --- a/bee-protocol/bee-protocol/src/peer/manager.rs +++ b/bee-protocol/bee-protocol/src/peer/manager.rs @@ -169,10 +169,10 @@ where // TODO can't do it in the if because of deadlock, but it's not really right to do it here. send_heartbeat( - &new_heartbeat(&*tangle, &*peer_manager), + &new_heartbeat(&*tangle, &peer_manager), &peer_id, - &*peer_manager, - &*metrics, + &peer_manager, + &metrics, ); } NetworkEvent::PeerDisconnected { peer_id } => peer_manager diff --git a/bee-protocol/bee-protocol/src/peer/mod.rs b/bee-protocol/bee-protocol/src/peer/mod.rs index 2d25253ab6..df254513a7 100644 --- a/bee-protocol/bee-protocol/src/peer/mod.rs +++ b/bee-protocol/bee-protocol/src/peer/mod.rs @@ -86,7 +86,7 @@ impl PeerWorker { request_latest_milestone( &*tangle, &self.milestone_requester, - &*requested_milestones, + &requested_milestones, Some(*self.peer.id()), ); diff --git a/bee-protocol/bee-protocol/src/solidifier.rs b/bee-protocol/bee-protocol/src/solidifier.rs index 254af727c4..14ddb35459 100644 --- a/bee-protocol/bee-protocol/src/solidifier.rs +++ b/bee-protocol/bee-protocol/src/solidifier.rs @@ -148,7 +148,7 @@ where // Request all milestones within a range. while next <= cmp::min(smi + MilestoneIndex(milestone_sync_count), lmi) { - request_milestone(&tangle, &milestone_requester, &*requested_milestones, next, None); + request_milestone(&tangle, &milestone_requester, &requested_milestones, next, None); next = next + MilestoneIndex(1); } diff --git a/bee-tangle/tests/milestone.rs b/bee-tangle/tests/milestone.rs index 0e1c3cb21a..375633c0e8 100644 --- a/bee-tangle/tests/milestone.rs +++ b/bee-tangle/tests/milestone.rs @@ -18,7 +18,7 @@ fn pack_unpack() { let packed = milestone.pack_to_vec(); assert_eq!( - MilestoneMetadata::unpack_verified(&mut packed.as_slice(), &()).unwrap(), + MilestoneMetadata::unpack_verified(packed.as_slice(), &()).unwrap(), milestone ); }