From b225197c65cada58ac5990e9d6f0497358fd3f14 Mon Sep 17 00:00:00 2001 From: Andres Date: Sun, 24 Nov 2024 11:52:21 -0300 Subject: [PATCH] fmt --- src/serializers/fields.rs | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/serializers/fields.rs b/src/serializers/fields.rs index 70136a542..cef336ec6 100644 --- a/src/serializers/fields.rs +++ b/src/serializers/fields.rs @@ -75,7 +75,6 @@ impl SerField { } } - fn exclude_if( exclude_if_callable: &Option>, value: &Bound<'_, PyAny>, @@ -92,13 +91,7 @@ fn exclude_if( Ok(false) } - -fn exclude_default( - value: &Bound<'_, PyAny>, - extra: &Extra, - serializer: &CombinedSerializer, -) -> PyResult { - +fn exclude_default(value: &Bound<'_, PyAny>, extra: &Extra, serializer: &CombinedSerializer) -> PyResult { if extra.exclude_defaults { if let Some(default) = serializer.get_default(value.py())? { if value.eq(default)? { @@ -209,12 +202,8 @@ impl GeneralFieldsSerializer { if exclude_if(&field.exclude_if, &value, serializer)? { continue; } - let value = serializer.to_python( - &value, - next_include.as_ref(), - next_exclude.as_ref(), - &field_extra, - )?; + let value = + serializer.to_python(&value, next_include.as_ref(), next_exclude.as_ref(), &field_extra)?; let output_key = field.get_key_py(output_dict.py(), &field_extra); output_dict.set_item(output_key, value)?; } @@ -294,9 +283,8 @@ impl GeneralFieldsSerializer { if let Some((next_include, next_exclude)) = filter { if let Some(field) = self.fields.get(key_str) { if let Some(ref serializer) = field.serializer { - if exclude_default(&value, &field_extra, serializer) - .map_err(py_err_se_err)?{ - continue; + if exclude_default(&value, &field_extra, serializer).map_err(py_err_se_err)? { + continue; } if exclude_if(&field.exclude_if, &value, serializer).map_err(py_err_se_err)? { continue;