From 37c207cdbd93cca13ea1b26c9ff5a54e21065ce5 Mon Sep 17 00:00:00 2001 From: Max Heller Date: Sat, 23 Nov 2024 10:13:49 -0500 Subject: [PATCH] switch schema name for [T] from "&[T]" to "[T]" --- source/postcard-schema/src/impls/builtins_nostd.rs | 2 +- source/postcard-schema/tests/schema.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/postcard-schema/src/impls/builtins_nostd.rs b/source/postcard-schema/src/impls/builtins_nostd.rs index b7fef43..a0ca029 100644 --- a/source/postcard-schema/src/impls/builtins_nostd.rs +++ b/source/postcard-schema/src/impls/builtins_nostd.rs @@ -90,7 +90,7 @@ impl Schema for &'_ T { impl Schema for [T] { const SCHEMA: &'static NamedType = &NamedType { - name: "&[T]", + name: "[T]", ty: &DataModelType::Seq(T::SCHEMA), }; } diff --git a/source/postcard-schema/tests/schema.rs b/source/postcard-schema/tests/schema.rs index 5feee3d..f7f047a 100644 --- a/source/postcard-schema/tests/schema.rs +++ b/source/postcard-schema/tests/schema.rs @@ -136,7 +136,7 @@ fn test_struct_serialize() { &NamedValue { name: "f", ty: &NamedType { - name: "&[T]", + name: "[T]", ty: &DataModelType::Seq(&NamedType { name: "u8", ty: &DataModelType::U8 @@ -156,7 +156,7 @@ fn test_slice_serialize() { ty: &DataModelType::Struct(&[&NamedValue { name: "x", ty: &NamedType { - name: "&[T]", + name: "[T]", ty: &DataModelType::Seq(&U8_SCHEMA) } },]), @@ -204,7 +204,7 @@ fn owned_punning() { // TODO: This is wildly repetitive, and likely could benefit from interning of // repeated types, strings, etc. - assert_eq!(ser_borrowed_schema.len(), 269); + assert_eq!(ser_borrowed_schema.len(), 268); // Check that we round-trip correctly let deser_borrowed_schema =