Repository: jonasbb/serde_with
Pull request #837 (2025-05-03 22:00:09)

Fix multiple clippy warnings


Patch:
diff --git a/serde_with/src/de/impls.rs b/serde_with/src/de/impls.rs
index 4d0de78..535d574 100644
--- a/serde_with/src/de/impls.rs
+++ b/serde_with/src/de/impls.rs
@@ -1563,8 +1563,7 @@ where
             Err(err) => err,
         };
         Err(DeError::custom(format_args!(
-            "OneOrMany could not deserialize any variant:\n  One: {}\n  Many: {}",
-            one_err, many_err
+            "OneOrMany could not deserialize any variant:\n  One: {one_err}\n  Many: {many_err}"
         )))
     }
 }
@@ -1608,8 +1607,7 @@ where
             Err(err) => err,
         };
         Err(DeError::custom(format_args!(
-            "PickFirst could not deserialize any variant:\n  First: {}\n  Second: {}",
-            first_err, second_err
+            "PickFirst could not deserialize any variant:\n  First: {first_err}\n  Second: {second_err}"
         )))
     }
 }
@@ -1647,8 +1645,7 @@ where
             Err(err) => err,
         };
         Err(DeError::custom(format_args!(
-            "PickFirst could not deserialize any variant:\n  First: {}\n  Second: {}\n  Third: {}",
-            first_err, second_err, third_err,
+            "PickFirst could not deserialize any variant:\n  First: {first_err}\n  Second: {second_err}\n  Third: {third_err}",
         )))
     }
 }
@@ -1693,8 +1690,7 @@ where
             Err(err) => err,
         };
         Err(DeError::custom(format_args!(
-            "PickFirst could not deserialize any variant:\n  First: {}\n  Second: {}\n  Third: {}\n  Fourth: {}",
-            first_err, second_err, third_err, fourth_err,
+            "PickFirst could not deserialize any variant:\n  First: {first_err}\n  Second: {second_err}\n  Third: {third_err}\n  Fourth: {fourth_err}",
         )))
     }
 }
diff --git a/serde_with_macros/src/utils.rs b/serde_with_macros/src/utils.rs
index e0d364c..0b27f2f 100644
--- a/serde_with_macros/src/utils.rs
+++ b/serde_with_macros/src/utils.rs
@@ -126,7 +126,7 @@ pub(crate) fn has_derive_jsonschema(input: TokenStream) -> syn::Result<SchemaFie
                 Ok(eval_metas(&metas)? & SchemaFieldConfig::Lazy(condition.into()))
             }
             path if path.is_ident("derive") => {
-                let config = meta
+                let config = if meta
                     .require_list()?
                     .parse_args_with(parse_derive_args)?
                     .into_iter()
@@ -139,10 +139,11 @@ pub(crate) fn has_derive_jsonschema(input: TokenStream) -> syn::Result<SchemaFie
                             Some(PathSegment { ident, .. }) => ident == "JsonSchema",
                             _ => false,
                         }
-                    })
-                    .then_some(SchemaFieldConfig::True)
-                    .unwrap_or_default();
-
+                    }) {
+                    SchemaFieldConfig::True
+                } else {
+                    LazyBool::default()
+                };
                 Ok(config)
             }
             _ => Ok(SchemaFieldConfig::False),
@@ -237,16 +238,18 @@ pub(crate) fn schemars_with_attr_if(
                 Ok(eval_metas(filter, &metas)? & SchemaFieldConfig::from(condition))
             }
             path if path.is_ident("schemars") => {
-                let config = meta
+                let config = if meta
                     .require_list()?
                     .parse_args_with(<Punctuated<Meta, Token![,]>>::parse_terminated)?
                     .into_iter()
                     .any(|meta| match meta.path().get_ident() {
                         Some(ident) => filter.iter().any(|relevant| ident == relevant),
                         _ => false,
-                    })
-                    .then_some(SchemaFieldConfig::True)
-                    .unwrap_or_default();
+                    }) {
+                    SchemaFieldConfig::True
+                } else {
+                    LazyBool::default()
+                };
                 Ok(config)
             }
             _ => Ok(SchemaFieldConfig::False),


Test patch:
diff --git a/serde_with/tests/utils.rs b/serde_with/tests/utils.rs
index e6917db..f2d5039 100644
--- a/serde_with/tests/utils.rs
+++ b/serde_with/tests/utils.rs
@@ -102,7 +102,7 @@ where
                 "Object was not valid according to its own schema:"
             );
 
-            let _ = writeln!(&mut message, "  -> {}", err);
+            let _ = writeln!(&mut message, "  -> {err}");
             let _ = writeln!(&mut message);
             let _ = writeln!(&mut message, "Object Value:");
             let _ = writeln!(