diff --git a/Cargo.lock b/Cargo.lock index 98e2326e1c25..8dc6c7638e86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9677,6 +9677,7 @@ name = "zksync_types" version = "0.1.0" dependencies = [ "anyhow", + "assert_matches", "bigdecimal", "bincode", "blake2 0.10.6", @@ -9760,6 +9761,7 @@ dependencies = [ name = "zksync_vm_interface" version = "0.1.0" dependencies = [ + "assert_matches", "hex", "serde", "thiserror", diff --git a/core/lib/multivm/src/versions/vm_1_3_2/errors/vm_revert_reason.rs b/core/lib/multivm/src/versions/vm_1_3_2/errors/vm_revert_reason.rs index ed17ffc4c39b..59ccbd584e77 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/errors/vm_revert_reason.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/errors/vm_revert_reason.rs @@ -167,6 +167,8 @@ impl VmRevertReasonParsingResult { mod tests { use std::convert::TryFrom; + use assert_matches::assert_matches; + use super::VmRevertReason; #[test] @@ -202,7 +204,7 @@ mod tests { 0, 0, 0, 0, 0, 0, 0, 0, 0, ]; let reason = VmRevertReason::try_from(msg.as_slice()).expect("Shouldn't be error"); - assert!(matches!(reason, VmRevertReason::Unknown { .. })); + assert_matches!(reason, VmRevertReason::Unknown { .. }); } #[test] diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tests/bootloader.rs b/core/lib/multivm/src/versions/vm_1_4_1/tests/bootloader.rs index f319964efb51..47e047ebbf72 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tests/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tests/bootloader.rs @@ -47,10 +47,10 @@ fn test_bootloader_out_of_gas() { let res = vm.vm.execute(VmExecutionMode::Batch); - assert!(matches!( + assert_matches!( res.result, ExecutionResult::Halt { reason: Halt::BootloaderOutOfGas } - )); + ); } diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tests/simple_execution.rs b/core/lib/multivm/src/versions/vm_1_4_1/tests/simple_execution.rs index 745f5ab378de..384bc4cf325e 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tests/simple_execution.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tests/simple_execution.rs @@ -28,7 +28,7 @@ fn estimate_fee() { vm_tester.vm.push_transaction(tx); let result = vm_tester.vm.execute(VmExecutionMode::OneTx); - assert!(matches!(result.result, ExecutionResult::Success { .. })); + assert_matches!(result.result, ExecutionResult::Success { .. }); } #[test] @@ -71,11 +71,11 @@ fn simple_execute() { vm.push_transaction(tx2); vm.push_transaction(tx3); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Revert { .. })); + assert_matches!(tx.result, ExecutionResult::Revert { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let block_tip = vm.execute(VmExecutionMode::Batch); - assert!(matches!(block_tip.result, ExecutionResult::Success { .. })); + assert_matches!(block_tip.result, ExecutionResult::Success { .. }); } diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tests/bootloader.rs b/core/lib/multivm/src/versions/vm_1_4_2/tests/bootloader.rs index 35d1666f10b9..8d69d05c4444 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tests/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tests/bootloader.rs @@ -46,10 +46,10 @@ fn test_bootloader_out_of_gas() { let res = vm.vm.execute(VmExecutionMode::Batch); - assert!(matches!( + assert_matches!( res.result, ExecutionResult::Halt { reason: Halt::BootloaderOutOfGas } - )); + ); } diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tests/simple_execution.rs b/core/lib/multivm/src/versions/vm_1_4_2/tests/simple_execution.rs index 0876dcf01a90..57b37e67b769 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tests/simple_execution.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tests/simple_execution.rs @@ -25,7 +25,7 @@ fn estimate_fee() { vm_tester.vm.push_transaction(tx); let result = vm_tester.vm.execute(VmExecutionMode::OneTx); - assert!(matches!(result.result, ExecutionResult::Success { .. })); + assert_matches!(result.result, ExecutionResult::Success { .. }); } #[test] @@ -68,11 +68,11 @@ fn simple_execute() { vm.push_transaction(tx2); vm.push_transaction(tx3); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Revert { .. })); + assert_matches!(tx.result, ExecutionResult::Revert { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let block_tip = vm.execute(VmExecutionMode::Batch); - assert!(matches!(block_tip.result, ExecutionResult::Success { .. })); + assert_matches!(block_tip.result, ExecutionResult::Success { .. }); } diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tests/bootloader.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tests/bootloader.rs index 0ee3b811b4ca..57229abb0978 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tests/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tests/bootloader.rs @@ -47,10 +47,10 @@ fn test_bootloader_out_of_gas() { let res = vm.vm.execute(VmExecutionMode::Batch); - assert!(matches!( + assert_matches!( res.result, ExecutionResult::Halt { reason: Halt::BootloaderOutOfGas } - )); + ); } diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tests/simple_execution.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tests/simple_execution.rs index fc94e2c71526..f6b1d83e02a3 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tests/simple_execution.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tests/simple_execution.rs @@ -28,7 +28,7 @@ fn estimate_fee() { vm_tester.vm.push_transaction(tx); let result = vm_tester.vm.execute(VmExecutionMode::OneTx); - assert!(matches!(result.result, ExecutionResult::Success { .. })); + assert_matches!(result.result, ExecutionResult::Success { .. }); } #[test] @@ -71,11 +71,11 @@ fn simple_execute() { vm.push_transaction(tx2); vm.push_transaction(tx3); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Revert { .. })); + assert_matches!(tx.result, ExecutionResult::Revert { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let block_tip = vm.execute(VmExecutionMode::Batch); - assert!(matches!(block_tip.result, ExecutionResult::Success { .. })); + assert_matches!(block_tip.result, ExecutionResult::Success { .. }); } diff --git a/core/lib/multivm/src/versions/vm_fast/tests/bootloader.rs b/core/lib/multivm/src/versions/vm_fast/tests/bootloader.rs index c698d36683ef..26f03eb30fdc 100644 --- a/core/lib/multivm/src/versions/vm_fast/tests/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_fast/tests/bootloader.rs @@ -1,3 +1,4 @@ +use assert_matches::assert_matches; use zksync_types::U256; use crate::{ @@ -44,10 +45,10 @@ fn test_bootloader_out_of_gas() { let res = vm.vm.execute(VmExecutionMode::Batch); - assert!(matches!( + assert_matches!( res.result, ExecutionResult::Halt { reason: Halt::BootloaderOutOfGas } - )); + ); } diff --git a/core/lib/multivm/src/versions/vm_fast/tests/simple_execution.rs b/core/lib/multivm/src/versions/vm_fast/tests/simple_execution.rs index 7d866e1539b0..88dbe1e6628a 100644 --- a/core/lib/multivm/src/versions/vm_fast/tests/simple_execution.rs +++ b/core/lib/multivm/src/versions/vm_fast/tests/simple_execution.rs @@ -1,3 +1,5 @@ +use assert_matches::assert_matches; + use crate::{ interface::{ExecutionResult, VmExecutionMode, VmInterface}, vm_fast::tests::tester::{TxType, VmTesterBuilder}, @@ -25,7 +27,7 @@ fn estimate_fee() { vm_tester.vm.push_transaction(tx); let result = vm_tester.vm.execute(VmExecutionMode::OneTx); - assert!(matches!(result.result, ExecutionResult::Success { .. })); + assert_matches!(result.result, ExecutionResult::Success { .. }); } #[test] @@ -68,11 +70,11 @@ fn simple_execute() { vm.push_transaction(tx2); vm.push_transaction(tx3); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Revert { .. })); + assert_matches!(tx.result, ExecutionResult::Revert { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let block_tip = vm.execute(VmExecutionMode::Batch); - assert!(matches!(block_tip.result, ExecutionResult::Success { .. })); + assert_matches!(block_tip.result, ExecutionResult::Success { .. }); } diff --git a/core/lib/multivm/src/versions/vm_latest/tests/bootloader.rs b/core/lib/multivm/src/versions/vm_latest/tests/bootloader.rs index 4b60c1992025..046d069e9203 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/bootloader.rs @@ -1,3 +1,4 @@ +use assert_matches::assert_matches; use zksync_types::U256; use crate::{ @@ -47,10 +48,10 @@ fn test_bootloader_out_of_gas() { let res = vm.vm.execute(VmExecutionMode::Batch); - assert!(matches!( + assert_matches!( res.result, ExecutionResult::Halt { reason: Halt::BootloaderOutOfGas } - )); + ); } diff --git a/core/lib/multivm/src/versions/vm_latest/tests/simple_execution.rs b/core/lib/multivm/src/versions/vm_latest/tests/simple_execution.rs index a864538524a2..7fc40981fb03 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/simple_execution.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/simple_execution.rs @@ -1,3 +1,5 @@ +use assert_matches::assert_matches; + use crate::{ interface::{ExecutionResult, VmExecutionMode, VmInterface}, vm_latest::{ @@ -28,7 +30,7 @@ fn estimate_fee() { vm_tester.vm.push_transaction(tx); let result = vm_tester.vm.execute(VmExecutionMode::OneTx); - assert!(matches!(result.result, ExecutionResult::Success { .. })); + assert_matches!(result.result, ExecutionResult::Success { .. }); } #[test] @@ -71,11 +73,11 @@ fn simple_execute() { vm.push_transaction(tx2); vm.push_transaction(tx3); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Revert { .. })); + assert_matches!(tx.result, ExecutionResult::Revert { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let block_tip = vm.execute(VmExecutionMode::Batch); - assert!(matches!(block_tip.result, ExecutionResult::Success { .. })); + assert_matches!(block_tip.result, ExecutionResult::Success { .. }); } diff --git a/core/lib/multivm/src/versions/vm_m5/errors/vm_revert_reason.rs b/core/lib/multivm/src/versions/vm_m5/errors/vm_revert_reason.rs index 7cfa8708fc30..ff3f02ed7161 100644 --- a/core/lib/multivm/src/versions/vm_m5/errors/vm_revert_reason.rs +++ b/core/lib/multivm/src/versions/vm_m5/errors/vm_revert_reason.rs @@ -148,6 +148,8 @@ impl VmRevertReasonParsingResult { mod tests { use std::convert::TryFrom; + use assert_matches::assert_matches; + use super::VmRevertReason; #[test] @@ -182,7 +184,7 @@ mod tests { 0, 0, 0, 0, 0, 0, 0, 0, 0, ]; let reason = VmRevertReason::try_from(msg.as_slice()).expect("Shouldn't be error"); - assert!(matches!(reason, VmRevertReason::Unknown { .. })); + assert_matches!(reason, VmRevertReason::Unknown { .. }); } #[test] diff --git a/core/lib/multivm/src/versions/vm_m6/errors/vm_revert_reason.rs b/core/lib/multivm/src/versions/vm_m6/errors/vm_revert_reason.rs index 0e5bf9fd8346..cc1a1aa2c653 100644 --- a/core/lib/multivm/src/versions/vm_m6/errors/vm_revert_reason.rs +++ b/core/lib/multivm/src/versions/vm_m6/errors/vm_revert_reason.rs @@ -167,6 +167,8 @@ impl VmRevertReasonParsingResult { mod tests { use std::convert::TryFrom; + use assert_matches::assert_matches; + use super::VmRevertReason; #[test] @@ -202,7 +204,7 @@ mod tests { 0, 0, 0, 0, 0, 0, 0, 0, 0, ]; let reason = VmRevertReason::try_from(msg.as_slice()).expect("Shouldn't be error"); - assert!(matches!(reason, VmRevertReason::Unknown { .. })); + assert_matches!(reason, VmRevertReason::Unknown { .. }); } #[test] diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/bootloader.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/bootloader.rs index bfa439106eaa..23b250d485b7 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/bootloader.rs @@ -45,10 +45,10 @@ fn test_bootloader_out_of_gas() { let res = vm.vm.execute(VmExecutionMode::Batch); - assert!(matches!( + assert_matches!( res.result, ExecutionResult::Halt { reason: Halt::BootloaderOutOfGas } - )); + ); } diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/simple_execution.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/simple_execution.rs index f85c2144de1d..eb5e38798379 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/simple_execution.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/simple_execution.rs @@ -24,7 +24,7 @@ fn estimate_fee() { vm_tester.vm.push_transaction(tx); let result = vm_tester.vm.execute(VmExecutionMode::OneTx); - assert!(matches!(result.result, ExecutionResult::Success { .. })); + assert_matches!(result.result, ExecutionResult::Success { .. }); } #[test] @@ -67,11 +67,11 @@ fn simple_execute() { vm.push_transaction(tx2); vm.push_transaction(tx3); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Revert { .. })); + assert_matches!(tx.result, ExecutionResult::Revert { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let block_tip = vm.execute(VmExecutionMode::Batch); - assert!(matches!(block_tip.result, ExecutionResult::Success { .. })); + assert_matches!(block_tip.result, ExecutionResult::Success { .. }); } diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/bootloader.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/bootloader.rs index 5abbd1dde47f..a30b5a58f638 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/bootloader.rs @@ -44,10 +44,10 @@ fn test_bootloader_out_of_gas() { let res = vm.vm.execute(VmExecutionMode::Batch); - assert!(matches!( + assert_matches!( res.result, ExecutionResult::Halt { reason: Halt::BootloaderOutOfGas } - )); + ); } diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/simple_execution.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/simple_execution.rs index 6b2237f5e59d..c4eac73499fc 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/simple_execution.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/simple_execution.rs @@ -24,7 +24,7 @@ fn estimate_fee() { vm_tester.vm.push_transaction(tx); let result = vm_tester.vm.execute(VmExecutionMode::OneTx); - assert!(matches!(result.result, ExecutionResult::Success { .. })); + assert_matches!(result.result, ExecutionResult::Success { .. }); } #[test] @@ -67,11 +67,11 @@ fn simple_execute() { vm.push_transaction(tx2); vm.push_transaction(tx3); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Revert { .. })); + assert_matches!(tx.result, ExecutionResult::Revert { .. }); let tx = vm.execute(VmExecutionMode::OneTx); - assert!(matches!(tx.result, ExecutionResult::Success { .. })); + assert_matches!(tx.result, ExecutionResult::Success { .. }); let block_tip = vm.execute(VmExecutionMode::Batch); - assert!(matches!(block_tip.result, ExecutionResult::Success { .. })); + assert_matches!(block_tip.result, ExecutionResult::Success { .. }); } diff --git a/core/lib/types/Cargo.toml b/core/lib/types/Cargo.toml index c80f304a75a6..55cbef761ad5 100644 --- a/core/lib/types/Cargo.toml +++ b/core/lib/types/Cargo.toml @@ -43,6 +43,7 @@ blake2.workspace = true [dev-dependencies] tokio = { workspace = true, features = ["rt", "macros"] } +assert_matches.workspace = true bincode.workspace = true [build-dependencies] diff --git a/core/lib/types/src/contract_verification_api.rs b/core/lib/types/src/contract_verification_api.rs index 588de3cb675e..8ee1d3ec6491 100644 --- a/core/lib/types/src/contract_verification_api.rs +++ b/core/lib/types/src/contract_verification_api.rs @@ -243,32 +243,31 @@ pub enum DeployContractCalldata { #[cfg(test)] mod tests { + use assert_matches::assert_matches; + use super::SourceCodeData; #[test] fn source_code_deserialization() { let single_file_str = r#"{"codeFormat": "solidity-single-file", "sourceCode": "text"}"#; let single_file_result = serde_json::from_str::(single_file_str); - assert!(matches!( - single_file_result, - Ok(SourceCodeData::SolSingleFile(_)) - )); + assert_matches!(single_file_result, Ok(SourceCodeData::SolSingleFile(_))); let stand_json_input_str = r#"{"codeFormat": "solidity-standard-json-input", "sourceCode": {}}"#; let stand_json_input_result = serde_json::from_str::(stand_json_input_str); - assert!(matches!( + assert_matches!( stand_json_input_result, Ok(SourceCodeData::StandardJsonInput(_)) - )); + ); let type_not_specified_str = r#"{"sourceCode": "text"}"#; let type_not_specified_result = serde_json::from_str::(type_not_specified_str); - assert!(matches!( + assert_matches!( type_not_specified_result, Ok(SourceCodeData::SolSingleFile(_)) - )); + ); let type_not_specified_object_str = r#"{"sourceCode": {}}"#; let type_not_specified_object_result = diff --git a/core/lib/types/src/transaction_request.rs b/core/lib/types/src/transaction_request.rs index 887dfcbff378..c71e6e4206c5 100644 --- a/core/lib/types/src/transaction_request.rs +++ b/core/lib/types/src/transaction_request.rs @@ -980,6 +980,7 @@ pub fn validate_factory_deps( #[cfg(test)] mod tests { + use assert_matches::assert_matches; use zksync_crypto_primitives::K256PrivateKey; use super::*; @@ -1427,10 +1428,10 @@ mod tests { tx.s = Some(U256::from_big_endian(signature.s())); let request = TransactionRequest::from_bytes(data.as_slice(), L2ChainId::from(270)).unwrap(); - assert!(matches!( + assert_matches!( L2Tx::from_request(request.0, random_tx_max_size), Err(SerializationTransactionError::OversizedData(_, _)) - )) + ) } #[test] @@ -1456,10 +1457,10 @@ mod tests { let try_to_l2_tx: Result = L2Tx::from_request(call_request.into(), random_tx_max_size); - assert!(matches!( + assert_matches!( try_to_l2_tx, Err(SerializationTransactionError::OversizedData(_, _)) - )); + ); } #[test] diff --git a/core/lib/vm_interface/Cargo.toml b/core/lib/vm_interface/Cargo.toml index 1d4efe06634b..a82c6ddadab5 100644 --- a/core/lib/vm_interface/Cargo.toml +++ b/core/lib/vm_interface/Cargo.toml @@ -19,3 +19,6 @@ hex.workspace = true serde.workspace = true thiserror.workspace = true tracing.workspace = true + +[dev-dependencies] +assert_matches.workspace = true diff --git a/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs b/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs index d76b7d4ddb9f..25ca5ebfe34b 100644 --- a/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs +++ b/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs @@ -169,6 +169,8 @@ impl fmt::Display for VmRevertReason { #[cfg(test)] mod tests { + use assert_matches::assert_matches; + use super::VmRevertReason; #[test] @@ -204,7 +206,7 @@ mod tests { 0, 0, 0, 0, 0, 0, 0, 0, 0, ]; let reason = VmRevertReason::try_from_bytes(msg.as_slice()).expect("Shouldn't be error"); - assert!(matches!(reason, VmRevertReason::Unknown { .. })); + assert_matches!(reason, VmRevertReason::Unknown { .. }); } #[test]