@@ -67,16 +67,12 @@ fn serde_value_from_list(_gil: Python<'_>, bind_value: &Bound<'_, PyAny>) -> PSQ
67
67
let mut result_vec: Vec < Value > = Vec :: with_capacity ( py_list. len ( ) ) ;
68
68
69
69
for item in py_list. iter ( ) {
70
- if item. is_instance_of :: < PyDict > ( ) {
71
- let python_dto = from_python_untyped ( & item) ?;
72
- result_vec. push ( python_dto. to_serde_value ( ) ?) ;
73
- } else if item. is_instance_of :: < PyList > ( ) {
70
+ if item. is_instance_of :: < PyList > ( ) {
74
71
let serde_value = build_serde_value ( & item) ?;
75
72
result_vec. push ( serde_value) ;
76
73
} else {
77
- return Err ( RustPSQLDriverError :: PyToRustValueConversionError (
78
- "Items in JSON array must be dicts or lists." . to_string ( ) ,
79
- ) ) ;
74
+ let python_dto = from_python_untyped ( & item) ?;
75
+ result_vec. push ( python_dto. to_serde_value ( ) ?) ;
80
76
}
81
77
}
82
78
@@ -112,17 +108,17 @@ fn serde_value_from_dict(bind_value: &Bound<'_, PyAny>) -> PSQLPyResult<Value> {
112
108
/// # Errors
113
109
/// May return error if cannot convert Python type into Rust one.
114
110
#[ allow( clippy:: needless_pass_by_value) ]
111
+ #[ allow( clippy:: needless_return) ]
115
112
pub fn build_serde_value ( value : & Bound < ' _ , PyAny > ) -> PSQLPyResult < Value > {
116
113
Python :: with_gil ( |gil| {
117
114
if value. is_instance_of :: < PyList > ( ) {
118
- serde_value_from_list ( gil, value)
115
+ return serde_value_from_list ( gil, value) ;
119
116
} else if value. is_instance_of :: < PyDict > ( ) {
120
117
return serde_value_from_dict ( value) ;
121
- } else {
122
- return Err ( RustPSQLDriverError :: PyToRustValueConversionError (
123
- "PyJSON must be dict value." . to_string ( ) ,
124
- ) ) ;
125
118
}
119
+ Err ( RustPSQLDriverError :: PyToRustValueConversionError (
120
+ "PyJSON must be dict or list value." . to_string ( ) ,
121
+ ) )
126
122
} )
127
123
}
128
124
0 commit comments