From eee094ca104d415f2e98296e83caed4ed17c5d9f Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 25 Sep 2024 17:58:22 +0300 Subject: [PATCH] Rename `unwrap_flatten` to `unwrap_flat` --- core/lib/types/src/api/mod.rs | 26 +++++++------------- core/node/api_server/src/web3/tests/debug.rs | 2 +- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/core/lib/types/src/api/mod.rs b/core/lib/types/src/api/mod.rs index 432b6c309c10..1e5a1b3fe65d 100644 --- a/core/lib/types/src/api/mod.rs +++ b/core/lib/types/src/api/mod.rs @@ -754,21 +754,17 @@ pub enum CallTracerBlockResult { } impl CallTracerBlockResult { - pub fn unwrap_flatten(self) -> Vec { + pub fn unwrap_flat(self) -> Vec { match self { - Self::CallTrace(_) => { - panic!("Result is a FlatCallTrace") - } - Self::FlatCallTrace(a) => a, + Self::CallTrace(_) => panic!("Result is a FlatCallTrace"), + Self::FlatCallTrace(trace) => trace, } } pub fn unwrap_default(self) -> Vec { match self { - Self::CallTrace(a) => a, - Self::FlatCallTrace(_) => { - panic!("Result is a CallTrace") - } + Self::CallTrace(trace) => trace, + Self::FlatCallTrace(_) => panic!("Result is a CallTrace"), } } } @@ -783,19 +779,15 @@ pub enum CallTracerResult { impl CallTracerResult { pub fn unwrap_flat(self) -> Vec { match self { - Self::CallTrace(_) => { - panic!("Result is a FlatCallTrace") - } - Self::FlatCallTrace(a) => a, + Self::CallTrace(_) => panic!("Result is a FlatCallTrace"), + Self::FlatCallTrace(trace) => trace, } } pub fn unwrap_default(self) -> DebugCall { match self { - Self::CallTrace(a) => a, - Self::FlatCallTrace(_) => { - panic!("Result is a CallTrace") - } + Self::CallTrace(trace) => trace, + Self::FlatCallTrace(_) => panic!("Result is a CallTrace"), } } } diff --git a/core/node/api_server/src/web3/tests/debug.rs b/core/node/api_server/src/web3/tests/debug.rs index 7711570c3c54..4f021b777aec 100644 --- a/core/node/api_server/src/web3/tests/debug.rs +++ b/core/node/api_server/src/web3/tests/debug.rs @@ -137,7 +137,7 @@ impl HttpTest for TraceBlockFlatTest { }), ) .await? - .unwrap_flatten(); + .unwrap_flat(); // A transaction with 2 nested calls will convert into 3 Flattened calls. // Also in this test, all tx have the same # of nested calls