From 531ddd42b7eae1beee24b80139921a06f7c3c5bb Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Fri, 8 Nov 2024 12:21:10 -0800 Subject: [PATCH] fixup: define roundtrip_to_extract_type outside of other function --- src/cli/subcommand/split_receipt.rs | 30 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/cli/subcommand/split_receipt.rs b/src/cli/subcommand/split_receipt.rs index 10ce65cc8..0b6499169 100644 --- a/src/cli/subcommand/split_receipt.rs +++ b/src/cli/subcommand/split_receipt.rs @@ -166,21 +166,6 @@ async fn two_phased_can_parse_receipt_perfectly( diagnostic_data: phase1_plan.diagnostic_data.clone(), }; - fn roundtrip_to_extract_type( - action: &StatefulAction>, - action_tag: &str, - ) -> eyre::Result> { - let action_json = serde_json::to_string(action).with_context(|| { - format!("serde_json::to_string'ing {action_tag} json to extract real type") - })?; - let action_unjson: StatefulAction = - serde_json::from_str(&action_json).with_context(|| { - format!("serde_json::from_str'ing {action_tag} json to extract real type") - })?; - - Ok(action_unjson) - } - for action in phase1_plan.actions.iter_mut() { let inner_typetag_name = action.inner_typetag_name(); match inner_typetag_name { @@ -475,3 +460,18 @@ async fn two_phased_cannot_parse_receipt_perfectly( Ok(()) } + +fn roundtrip_to_extract_type( + action: &StatefulAction>, + action_tag: &str, +) -> eyre::Result> { + let action_json = serde_json::to_string(action).with_context(|| { + format!("serde_json::to_string'ing {action_tag} json to extract real type") + })?; + let action_unjson: StatefulAction = + serde_json::from_str(&action_json).with_context(|| { + format!("serde_json::from_str'ing {action_tag} json to extract real type") + })?; + + Ok(action_unjson) +}