Skip to content

Commit b225197

Browse files
committed
fmt
1 parent 68955e6 commit b225197

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

src/serializers/fields.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ impl SerField {
7575
}
7676
}
7777

78-
7978
fn exclude_if(
8079
exclude_if_callable: &Option<Py<PyAny>>,
8180
value: &Bound<'_, PyAny>,
@@ -92,13 +91,7 @@ fn exclude_if(
9291
Ok(false)
9392
}
9493

95-
96-
fn exclude_default(
97-
value: &Bound<'_, PyAny>,
98-
extra: &Extra,
99-
serializer: &CombinedSerializer,
100-
) -> PyResult<bool> {
101-
94+
fn exclude_default(value: &Bound<'_, PyAny>, extra: &Extra, serializer: &CombinedSerializer) -> PyResult<bool> {
10295
if extra.exclude_defaults {
10396
if let Some(default) = serializer.get_default(value.py())? {
10497
if value.eq(default)? {
@@ -209,12 +202,8 @@ impl GeneralFieldsSerializer {
209202
if exclude_if(&field.exclude_if, &value, serializer)? {
210203
continue;
211204
}
212-
let value = serializer.to_python(
213-
&value,
214-
next_include.as_ref(),
215-
next_exclude.as_ref(),
216-
&field_extra,
217-
)?;
205+
let value =
206+
serializer.to_python(&value, next_include.as_ref(), next_exclude.as_ref(), &field_extra)?;
218207
let output_key = field.get_key_py(output_dict.py(), &field_extra);
219208
output_dict.set_item(output_key, value)?;
220209
}
@@ -294,9 +283,8 @@ impl GeneralFieldsSerializer {
294283
if let Some((next_include, next_exclude)) = filter {
295284
if let Some(field) = self.fields.get(key_str) {
296285
if let Some(ref serializer) = field.serializer {
297-
if exclude_default(&value, &field_extra, serializer)
298-
.map_err(py_err_se_err)?{
299-
continue;
286+
if exclude_default(&value, &field_extra, serializer).map_err(py_err_se_err)? {
287+
continue;
300288
}
301289
if exclude_if(&field.exclude_if, &value, serializer).map_err(py_err_se_err)? {
302290
continue;

0 commit comments

Comments
 (0)