diff --git a/schemars/tests/default.rs b/schemars/tests/default.rs index e654630..fbc1033 100644 --- a/schemars/tests/default.rs +++ b/schemars/tests/default.rs @@ -56,15 +56,3 @@ struct NotSerialize; fn schema_default_values() -> TestResult { test_default_generated_schema::("default") } - -#[allow(dead_code)] -#[derive(JsonSchema)] -struct StructWithGenericDefaults { - #[serde(default = "Vec::new")] - a_vec: Vec, -} - -#[test] -fn schema_with_generic_default_value() -> TestResult { - test_default_generated_schema::("generic_default") -} diff --git a/schemars/tests/expected/generic_default.json b/schemars/tests/expected/generic_default.json deleted file mode 100644 index 095b999..0000000 --- a/schemars/tests/expected/generic_default.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "StructWithGenericDefaults", - "type": "object", - "properties": { - "a_vec": { - "default": [], - "type": "array", - "items": { - "type": "string" - } - } - } -} \ No newline at end of file diff --git a/schemars_derive/src/schema_exprs.rs b/schemars_derive/src/schema_exprs.rs index f41e37a..c5b1672 100644 --- a/schemars_derive/src/schema_exprs.rs +++ b/schemars_derive/src/schema_exprs.rs @@ -581,7 +581,7 @@ fn field_default_expr(field: &Field, container_has_default: bool) -> Option quote!(<#ty>::default()), - SerdeDefault::Path(path) => quote!({ #path() as #ty }), + SerdeDefault::Path(path) => quote!(#path()), }; let default_expr = match field.serde_attrs.skip_serializing_if() {