1515
1616use std:: collections:: HashMap ;
1717
18- use cpex_core:: executor:: PipelineResult ;
1918use cpex_core:: error:: PluginErrorRecord ;
19+ use cpex_core:: executor:: PipelineResult ;
2020use pyo3:: prelude:: * ;
2121use pyo3:: types:: PyDict ;
2222use serde_json:: Value ;
@@ -52,7 +52,7 @@ impl PyPipelineResult {
5252 "cpex: modified_payload is not a dict" ,
5353 )
5454 } ) ?) )
55- }
55+ } ,
5656 }
5757 }
5858
@@ -67,7 +67,7 @@ impl PyPipelineResult {
6767 "cpex: modified_extensions is not a dict" ,
6868 )
6969 } ) ?) )
70- }
70+ } ,
7171 }
7272 }
7373
@@ -78,11 +78,9 @@ impl PyPipelineResult {
7878 Some ( v) => {
7979 let obj = json_value_to_pyobj ( py, v) ?;
8080 Ok ( Some ( obj. cast_into :: < PyDict > ( ) . map_err ( |_| {
81- pyo3:: exceptions:: PyRuntimeError :: new_err (
82- "cpex: violation is not a dict" ,
83- )
81+ pyo3:: exceptions:: PyRuntimeError :: new_err ( "cpex: violation is not a dict" )
8482 } ) ?) )
85- }
83+ } ,
8684 }
8785 }
8886
@@ -93,9 +91,7 @@ impl PyPipelineResult {
9391 . map ( |v| {
9492 let obj = json_value_to_pyobj ( py, v) ?;
9593 obj. cast_into :: < PyDict > ( ) . map_err ( |_| {
96- pyo3:: exceptions:: PyRuntimeError :: new_err (
97- "cpex: error entry is not a dict" ,
98- )
94+ pyo3:: exceptions:: PyRuntimeError :: new_err ( "cpex: error entry is not a dict" )
9995 } )
10096 } )
10197 . collect ( )
@@ -108,11 +104,9 @@ impl PyPipelineResult {
108104 Some ( v) => {
109105 let obj = json_value_to_pyobj ( py, v) ?;
110106 Ok ( Some ( obj. cast_into :: < PyDict > ( ) . map_err ( |_| {
111- pyo3:: exceptions:: PyRuntimeError :: new_err (
112- "cpex: metadata is not a dict" ,
113- )
107+ pyo3:: exceptions:: PyRuntimeError :: new_err ( "cpex: metadata is not a dict" )
114108 } ) ?) )
115- }
109+ } ,
116110 }
117111 }
118112
@@ -128,7 +122,11 @@ impl PyPipelineResult {
128122 format ! (
129123 "PipelineResult(continue_processing={}, violation={}, errors={})" ,
130124 self . continue_processing,
131- if self . violation. is_some( ) { "Some(...)" } else { "None" } ,
125+ if self . violation. is_some( ) {
126+ "Some(...)"
127+ } else {
128+ "None"
129+ } ,
132130 self . errors. len( ) ,
133131 )
134132 }
@@ -150,9 +148,7 @@ pub fn pipeline_result_to_py(mut result: PipelineResult) -> PyResult<PyPipelineR
150148 Some ( p) => match serialize_payload ( p. as_ref ( ) ) {
151149 Some ( v) => Some ( v) ,
152150 None => {
153- tracing:: warn!(
154- "cpex-python: modified payload could not be serialised; dropping"
155- ) ;
151+ tracing:: warn!( "cpex-python: modified payload could not be serialised; dropping" ) ;
156152 result. errors . push ( PluginErrorRecord {
157153 plugin_name : "<py>" . to_string ( ) ,
158154 message : "modified payload could not be serialised across the PyO3 boundary"
@@ -162,7 +158,7 @@ pub fn pipeline_result_to_py(mut result: PipelineResult) -> PyResult<PyPipelineR
162158 proto_error_code : None ,
163159 } ) ;
164160 None
165- }
161+ } ,
166162 } ,
167163 } ;
168164
0 commit comments