From fbcfd1df492e45dfe5fcb2a5d8482e6d62cb2e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dj8yf0=CE=BCl?= <26653921+dj8yfo@users.noreply.github.com> Date: Thu, 29 Feb 2024 21:35:23 +0200 Subject: [PATCH] chore: remove conflicts with `W`/`R` parameters for `BorshSerialize`/`BorshDeserialize` derives (#283) --- .../src/internals/deserialize/enums/mod.rs | 6 ++-- .../snapshots/borsh_discriminant_false.snap | 9 +++--- .../snapshots/borsh_discriminant_true.snap | 9 +++--- .../enums/snapshots/borsh_init_func.snap | 9 +++--- .../borsh_skip_struct_variant_field.snap | 9 +++--- .../borsh_skip_tuple_variant_field.snap | 9 +++--- .../enums/snapshots/bound_generics.snap | 9 +++--- .../check_deserialize_with_attr.snap | 9 +++--- .../generic_borsh_skip_struct_field.snap | 9 +++--- .../generic_borsh_skip_tuple_field.snap | 9 +++--- .../snapshots/generic_deserialize_bound.snap | 9 +++--- .../enums/snapshots/recursive_enum.snap | 9 +++--- .../simple_enum_with_custom_crate.snap | 9 +++--- .../enums/snapshots/simple_generics.snap | 9 +++--- .../src/internals/deserialize/structs/mod.rs | 4 +-- .../structs/snapshots/borsh_init_func.snap | 5 ++-- .../structs/snapshots/bound_generics.snap | 5 ++-- .../check_deserialize_with_attr.snap | 5 ++-- .../snapshots/generic_deserialize_bound.snap | 5 ++-- ...eneric_named_fields_struct_borsh_skip.snap | 5 ++-- .../generic_tuple_struct_borsh_skip1.snap | 5 ++-- .../generic_tuple_struct_borsh_skip2.snap | 5 ++-- ...ide_automatically_added_default_trait.snap | 5 ++-- .../structs/snapshots/recursive_struct.snap | 5 ++-- .../simple_generic_tuple_struct.snap | 5 ++-- .../structs/snapshots/simple_generics.snap | 5 ++-- .../structs/snapshots/simple_struct.snap | 5 ++-- .../simple_struct_with_custom_crate.snap | 5 ++-- .../src/internals/serialize/enums/mod.rs | 2 +- .../snapshots/borsh_discriminant_false.snap | 5 ++-- .../snapshots/borsh_discriminant_true.snap | 5 ++-- .../borsh_skip_struct_variant_all_fields.snap | 5 ++-- .../borsh_skip_struct_variant_field.snap | 5 ++-- .../borsh_skip_tuple_variant_field.snap | 5 ++-- .../enums/snapshots/bound_generics.snap | 5 ++-- .../snapshots/check_serialize_with_attr.snap | 5 ++-- .../generic_borsh_skip_struct_field.snap | 5 ++-- .../generic_borsh_skip_tuple_field.snap | 5 ++-- .../snapshots/generic_serialize_bound.snap | 5 ++-- .../snapshots/mixed_with_unit_variants.snap | 5 ++-- .../enums/snapshots/recursive_enum.snap | 5 ++-- .../simple_enum_with_custom_crate.snap | 5 ++-- .../enums/snapshots/simple_generics.snap | 5 ++-- .../enums/snapshots/struct_variant_field.snap | 5 ++-- .../src/internals/serialize/structs/mod.rs | 2 +- .../structs/snapshots/bound_generics.snap | 5 ++-- .../snapshots/check_serialize_with_attr.snap | 5 ++-- .../snapshots/generic_associated_type.snap | 5 ++-- ...eneric_named_fields_struct_borsh_skip.snap | 5 ++-- .../snapshots/generic_serialize_bound.snap | 5 ++-- .../generic_tuple_struct_borsh_skip1.snap | 5 ++-- .../generic_tuple_struct_borsh_skip2.snap | 5 ++-- ..._generic_associated_type_wrong_derive.snap | 5 ++-- .../structs/snapshots/recursive_struct.snap | 5 ++-- .../simple_generic_tuple_struct.snap | 5 ++-- .../structs/snapshots/simple_generics.snap | 5 ++-- .../structs/snapshots/simple_struct.snap | 5 ++-- .../simple_struct_with_custom_crate.snap | 5 ++-- borsh/tests/test_generic_struct.rs | 28 +++++++++---------- 59 files changed, 155 insertions(+), 209 deletions(-) diff --git a/borsh-derive/src/internals/deserialize/enums/mod.rs b/borsh-derive/src/internals/deserialize/enums/mod.rs index 8f6b871ab..fb405e90d 100644 --- a/borsh-derive/src/internals/deserialize/enums/mod.rs +++ b/borsh-derive/src/internals/deserialize/enums/mod.rs @@ -34,15 +34,15 @@ pub fn process(input: &ItemEnum, cratename: Path) -> syn::Result { Ok(quote! { impl #impl_generics #cratename::de::BorshDeserialize for #name #ty_generics #where_clause { - fn deserialize_reader(reader: &mut R) -> ::core::result::Result { + fn deserialize_reader<__R: #cratename::io::Read>(reader: &mut __R) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) } } impl #impl_generics #cratename::de::EnumExt for #name #ty_generics #where_clause { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: #cratename::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_discriminant_false.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_discriminant_false.snap index 0230f7747..1e0446681 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_discriminant_false.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_discriminant_false.snap @@ -3,16 +3,16 @@ source: borsh-derive/src/internals/deserialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::de::BorshDeserialize for X { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) } } impl borsh::de::EnumExt for X { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0u8 { @@ -40,4 +40,3 @@ impl borsh::de::EnumExt for X { Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_discriminant_true.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_discriminant_true.snap index 541a1df84..add0f62ed 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_discriminant_true.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_discriminant_true.snap @@ -3,16 +3,16 @@ source: borsh-derive/src/internals/deserialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::de::BorshDeserialize for X { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) } } impl borsh::de::EnumExt for X { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0 { @@ -40,4 +40,3 @@ impl borsh::de::EnumExt for X { Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_init_func.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_init_func.snap index d5e070dd6..28dd7dbce 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_init_func.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_init_func.snap @@ -3,16 +3,16 @@ source: borsh-derive/src/internals/deserialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::de::BorshDeserialize for A { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) } } impl borsh::de::EnumExt for A { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0u8 { @@ -41,4 +41,3 @@ impl borsh::de::EnumExt for A { Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_skip_struct_variant_field.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_skip_struct_variant_field.snap index 7c325c295..a8a2d9e1a 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_skip_struct_variant_field.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_skip_struct_variant_field.snap @@ -3,16 +3,16 @@ source: borsh-derive/src/internals/deserialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::de::BorshDeserialize for AA { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) } } impl borsh::de::EnumExt for AA { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0u8 { @@ -37,4 +37,3 @@ impl borsh::de::EnumExt for AA { Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_skip_tuple_variant_field.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_skip_tuple_variant_field.snap index 6062e702d..60149fc60 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_skip_tuple_variant_field.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/borsh_skip_tuple_variant_field.snap @@ -3,16 +3,16 @@ source: borsh-derive/src/internals/deserialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::de::BorshDeserialize for AAT { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) } } impl borsh::de::EnumExt for AAT { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0u8 { @@ -37,4 +37,3 @@ impl borsh::de::EnumExt for AAT { Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/bound_generics.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/bound_generics.snap index 87c803f3f..6b31f4bc6 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/bound_generics.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/bound_generics.snap @@ -9,8 +9,8 @@ where V: borsh::de::BorshDeserialize, U: borsh::de::BorshDeserialize, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) @@ -23,8 +23,8 @@ where V: borsh::de::BorshDeserialize, U: borsh::de::BorshDeserialize, { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0u8 { @@ -50,4 +50,3 @@ where Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/check_deserialize_with_attr.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/check_deserialize_with_attr.snap index 2d74a476c..968e0c3b5 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/check_deserialize_with_attr.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/check_deserialize_with_attr.snap @@ -7,8 +7,8 @@ where K: borsh::de::BorshDeserialize, V: borsh::de::BorshDeserialize, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) @@ -19,8 +19,8 @@ where K: borsh::de::BorshDeserialize, V: borsh::de::BorshDeserialize, { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0u8 { @@ -46,4 +46,3 @@ where Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/generic_borsh_skip_struct_field.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/generic_borsh_skip_struct_field.snap index 88606d923..cde62e488 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/generic_borsh_skip_struct_field.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/generic_borsh_skip_struct_field.snap @@ -10,8 +10,8 @@ where K: core::default::Default, V: core::default::Default, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) @@ -25,8 +25,8 @@ where K: core::default::Default, V: core::default::Default, { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0u8 { @@ -52,4 +52,3 @@ where Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/generic_borsh_skip_tuple_field.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/generic_borsh_skip_tuple_field.snap index 018857728..0cc108681 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/generic_borsh_skip_tuple_field.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/generic_borsh_skip_tuple_field.snap @@ -9,8 +9,8 @@ where V: borsh::de::BorshDeserialize, U: core::default::Default, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) @@ -23,8 +23,8 @@ where V: borsh::de::BorshDeserialize, U: core::default::Default, { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0u8 { @@ -50,4 +50,3 @@ where Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/generic_deserialize_bound.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/generic_deserialize_bound.snap index 486b3e42f..adf641118 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/generic_deserialize_bound.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/generic_deserialize_bound.snap @@ -7,8 +7,8 @@ where T: PartialOrd + Hash + Eq + borsh::de::BorshDeserialize, U: borsh::de::BorshDeserialize, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) @@ -19,8 +19,8 @@ where T: PartialOrd + Hash + Eq + borsh::de::BorshDeserialize, U: borsh::de::BorshDeserialize, { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0u8 { @@ -46,4 +46,3 @@ where Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/recursive_enum.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/recursive_enum.snap index 76473c24b..b3c8f7790 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/recursive_enum.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/recursive_enum.snap @@ -8,8 +8,8 @@ where K: borsh::de::BorshDeserialize, V: borsh::de::BorshDeserialize, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) @@ -21,8 +21,8 @@ where K: borsh::de::BorshDeserialize, V: borsh::de::BorshDeserialize, { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0u8 { @@ -48,4 +48,3 @@ where Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/simple_enum_with_custom_crate.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/simple_enum_with_custom_crate.snap index a1395c9db..88457ee99 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/simple_enum_with_custom_crate.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/simple_enum_with_custom_crate.snap @@ -3,8 +3,8 @@ source: borsh-derive/src/internals/deserialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl reexporter::borsh::de::BorshDeserialize for A { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: reexporter::borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader( reader, @@ -13,8 +13,8 @@ impl reexporter::borsh::de::BorshDeserialize for A { } } impl reexporter::borsh::de::EnumExt for A { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: reexporter::borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0u8 { @@ -40,4 +40,3 @@ impl reexporter::borsh::de::EnumExt for A { Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/enums/snapshots/simple_generics.snap b/borsh-derive/src/internals/deserialize/enums/snapshots/simple_generics.snap index 7dc6b1f08..d8b85259c 100644 --- a/borsh-derive/src/internals/deserialize/enums/snapshots/simple_generics.snap +++ b/borsh-derive/src/internals/deserialize/enums/snapshots/simple_generics.snap @@ -8,8 +8,8 @@ where V: borsh::de::BorshDeserialize, U: borsh::de::BorshDeserialize, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let tag = ::deserialize_reader(reader)?; ::deserialize_variant(reader, tag) @@ -21,8 +21,8 @@ where V: borsh::de::BorshDeserialize, U: borsh::de::BorshDeserialize, { - fn deserialize_variant( - reader: &mut R, + fn deserialize_variant<__R: borsh::io::Read>( + reader: &mut __R, variant_tag: u8, ) -> ::core::result::Result { let mut return_value = if variant_tag == 0u8 { @@ -48,4 +48,3 @@ where Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/mod.rs b/borsh-derive/src/internals/deserialize/structs/mod.rs index 837a38a11..0faaec309 100644 --- a/borsh-derive/src/internals/deserialize/structs/mod.rs +++ b/borsh-derive/src/internals/deserialize/structs/mod.rs @@ -40,7 +40,7 @@ pub fn process(input: &ItemStruct, cratename: Path) -> syn::Result if let Some(method_ident) = item::contains_initialize_with(&input.attrs)? { Ok(quote! { impl #impl_generics #cratename::de::BorshDeserialize for #name #ty_generics #where_clause { - fn deserialize_reader(reader: &mut R) -> ::core::result::Result { + fn deserialize_reader<__R: #cratename::io::Read>(reader: &mut __R) -> ::core::result::Result { let mut return_value = #return_value; return_value.#method_ident(); Ok(return_value) @@ -50,7 +50,7 @@ pub fn process(input: &ItemStruct, cratename: Path) -> syn::Result } else { Ok(quote! { impl #impl_generics #cratename::de::BorshDeserialize for #name #ty_generics #where_clause { - fn deserialize_reader(reader: &mut R) -> ::core::result::Result { + fn deserialize_reader<__R: #cratename::io::Read>(reader: &mut __R) -> ::core::result::Result { Ok(#return_value) } } diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/borsh_init_func.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/borsh_init_func.snap index 417d0e1d9..61f51e48e 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/borsh_init_func.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/borsh_init_func.snap @@ -3,8 +3,8 @@ source: borsh-derive/src/internals/deserialize/structs/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::de::BorshDeserialize for A { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { let mut return_value = Self { x: borsh::BorshDeserialize::deserialize_reader(reader)?, @@ -14,4 +14,3 @@ impl borsh::de::BorshDeserialize for A { Ok(return_value) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/bound_generics.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/bound_generics.snap index 9799faca0..dc4514d64 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/bound_generics.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/bound_generics.snap @@ -8,8 +8,8 @@ where K: borsh::de::BorshDeserialize, V: borsh::de::BorshDeserialize, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { Ok(Self { x: borsh::BorshDeserialize::deserialize_reader(reader)?, @@ -17,4 +17,3 @@ where }) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/check_deserialize_with_attr.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/check_deserialize_with_attr.snap index 22798639e..79a844803 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/check_deserialize_with_attr.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/check_deserialize_with_attr.snap @@ -7,8 +7,8 @@ where K: borsh::de::BorshDeserialize, V: borsh::de::BorshDeserialize, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { Ok(Self { x: third_party_impl::deserialize_third_party(reader)?, @@ -16,4 +16,3 @@ where }) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/generic_deserialize_bound.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/generic_deserialize_bound.snap index a17b005c0..7e4a0317b 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/generic_deserialize_bound.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/generic_deserialize_bound.snap @@ -7,8 +7,8 @@ where T: PartialOrd + Hash + Eq + borsh::de::BorshDeserialize, U: borsh::de::BorshDeserialize, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { Ok(Self { a: borsh::BorshDeserialize::deserialize_reader(reader)?, @@ -16,4 +16,3 @@ where }) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/generic_named_fields_struct_borsh_skip.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/generic_named_fields_struct_borsh_skip.snap index eebe6a1e8..c094081c6 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/generic_named_fields_struct_borsh_skip.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/generic_named_fields_struct_borsh_skip.snap @@ -8,8 +8,8 @@ where K: core::default::Default, V: core::default::Default, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { Ok(Self { x: core::default::Default::default(), @@ -17,4 +17,3 @@ where }) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/generic_tuple_struct_borsh_skip1.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/generic_tuple_struct_borsh_skip1.snap index 53fd0f8bb..492cc2b14 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/generic_tuple_struct_borsh_skip1.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/generic_tuple_struct_borsh_skip1.snap @@ -8,8 +8,8 @@ where K: core::default::Default, V: core::default::Default, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { Ok( Self( @@ -19,4 +19,3 @@ where ) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/generic_tuple_struct_borsh_skip2.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/generic_tuple_struct_borsh_skip2.snap index e6e142567..5abdae6be 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/generic_tuple_struct_borsh_skip2.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/generic_tuple_struct_borsh_skip2.snap @@ -8,8 +8,8 @@ where V: borsh::de::BorshDeserialize, U: core::default::Default, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { Ok( Self( @@ -19,4 +19,3 @@ where ) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/override_automatically_added_default_trait.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/override_automatically_added_default_trait.snap index 3d450380c..546931471 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/override_automatically_added_default_trait.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/override_automatically_added_default_trait.snap @@ -6,8 +6,8 @@ impl borsh::de::BorshDeserialize for G1 where U: borsh::de::BorshDeserialize, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { Ok( Self( @@ -17,4 +17,3 @@ where ) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/recursive_struct.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/recursive_struct.snap index 4f9738096..0dd795c39 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/recursive_struct.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/recursive_struct.snap @@ -3,8 +3,8 @@ source: borsh-derive/src/internals/deserialize/structs/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::de::BorshDeserialize for CRecC { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { Ok(Self { a: borsh::BorshDeserialize::deserialize_reader(reader)?, @@ -12,4 +12,3 @@ impl borsh::de::BorshDeserialize for CRecC { }) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/simple_generic_tuple_struct.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/simple_generic_tuple_struct.snap index 4c7f939b1..c1d69d951 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/simple_generic_tuple_struct.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/simple_generic_tuple_struct.snap @@ -6,8 +6,8 @@ impl borsh::de::BorshDeserialize for TupleA where T: borsh::de::BorshDeserialize, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { Ok( Self( @@ -17,4 +17,3 @@ where ) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/simple_generics.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/simple_generics.snap index e33d4e9d6..f2a8c7c4b 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/simple_generics.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/simple_generics.snap @@ -7,8 +7,8 @@ where K: borsh::de::BorshDeserialize, V: borsh::de::BorshDeserialize, { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { Ok(Self { x: borsh::BorshDeserialize::deserialize_reader(reader)?, @@ -16,4 +16,3 @@ where }) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/simple_struct.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/simple_struct.snap index 39b182a7d..6026d09f0 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/simple_struct.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/simple_struct.snap @@ -3,8 +3,8 @@ source: borsh-derive/src/internals/deserialize/structs/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::de::BorshDeserialize for A { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { Ok(Self { x: borsh::BorshDeserialize::deserialize_reader(reader)?, @@ -12,4 +12,3 @@ impl borsh::de::BorshDeserialize for A { }) } } - diff --git a/borsh-derive/src/internals/deserialize/structs/snapshots/simple_struct_with_custom_crate.snap b/borsh-derive/src/internals/deserialize/structs/snapshots/simple_struct_with_custom_crate.snap index b5bb0b89c..ad7fb3788 100644 --- a/borsh-derive/src/internals/deserialize/structs/snapshots/simple_struct_with_custom_crate.snap +++ b/borsh-derive/src/internals/deserialize/structs/snapshots/simple_struct_with_custom_crate.snap @@ -3,8 +3,8 @@ source: borsh-derive/src/internals/deserialize/structs/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl reexporter::borsh::de::BorshDeserialize for A { - fn deserialize_reader( - reader: &mut R, + fn deserialize_reader<__R: reexporter::borsh::io::Read>( + reader: &mut __R, ) -> ::core::result::Result { Ok(Self { x: reexporter::borsh::BorshDeserialize::deserialize_reader(reader)?, @@ -12,4 +12,3 @@ impl reexporter::borsh::de::BorshDeserialize for A { }) } } - diff --git a/borsh-derive/src/internals/serialize/enums/mod.rs b/borsh-derive/src/internals/serialize/enums/mod.rs index 923f1ee62..4e86ca2d4 100644 --- a/borsh-derive/src/internals/serialize/enums/mod.rs +++ b/borsh-derive/src/internals/serialize/enums/mod.rs @@ -45,7 +45,7 @@ pub fn process(input: &ItemEnum, cratename: Path) -> syn::Result { Ok(quote! { impl #impl_generics #cratename::ser::BorshSerialize for #enum_ident #ty_generics #where_clause { - fn serialize(&self, writer: &mut W) -> ::core::result::Result<(), #cratename::io::Error> { + fn serialize<__W: #cratename::io::Write>(&self, writer: &mut __W) -> ::core::result::Result<(), #cratename::io::Error> { let variant_idx: u8 = match self { #all_variants_idx_body }; diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/borsh_discriminant_false.snap b/borsh-derive/src/internals/serialize/enums/snapshots/borsh_discriminant_false.snap index 9fc0d1487..05e1f88e9 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/borsh_discriminant_false.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/borsh_discriminant_false.snap @@ -3,9 +3,9 @@ source: borsh-derive/src/internals/serialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::ser::BorshSerialize for X { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { X::A => 0u8, @@ -19,4 +19,3 @@ impl borsh::ser::BorshSerialize for X { Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/borsh_discriminant_true.snap b/borsh-derive/src/internals/serialize/enums/snapshots/borsh_discriminant_true.snap index 75ae04424..ee3371232 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/borsh_discriminant_true.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/borsh_discriminant_true.snap @@ -3,9 +3,9 @@ source: borsh-derive/src/internals/serialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::ser::BorshSerialize for X { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { X::A => 0, @@ -19,4 +19,3 @@ impl borsh::ser::BorshSerialize for X { Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/borsh_skip_struct_variant_all_fields.snap b/borsh-derive/src/internals/serialize/enums/snapshots/borsh_skip_struct_variant_all_fields.snap index 27f0fc945..b8943a467 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/borsh_skip_struct_variant_all_fields.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/borsh_skip_struct_variant_all_fields.snap @@ -3,9 +3,9 @@ source: borsh-derive/src/internals/serialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::ser::BorshSerialize for AAB { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { AAB::B { .. } => 0u8, @@ -21,4 +21,3 @@ impl borsh::ser::BorshSerialize for AAB { Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/borsh_skip_struct_variant_field.snap b/borsh-derive/src/internals/serialize/enums/snapshots/borsh_skip_struct_variant_field.snap index 737f0a478..f5ff6946d 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/borsh_skip_struct_variant_field.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/borsh_skip_struct_variant_field.snap @@ -3,9 +3,9 @@ source: borsh-derive/src/internals/serialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::ser::BorshSerialize for AB { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { AB::B { .. } => 0u8, @@ -23,4 +23,3 @@ impl borsh::ser::BorshSerialize for AB { Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/borsh_skip_tuple_variant_field.snap b/borsh-derive/src/internals/serialize/enums/snapshots/borsh_skip_tuple_variant_field.snap index 17d050126..fc3be0087 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/borsh_skip_tuple_variant_field.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/borsh_skip_tuple_variant_field.snap @@ -3,9 +3,9 @@ source: borsh-derive/src/internals/serialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::ser::BorshSerialize for AATTB { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { AATTB::B(..) => 0u8, @@ -21,4 +21,3 @@ impl borsh::ser::BorshSerialize for AATTB { Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/bound_generics.snap b/borsh-derive/src/internals/serialize/enums/snapshots/bound_generics.snap index 5c4129d68..9c1630967 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/bound_generics.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/bound_generics.snap @@ -9,9 +9,9 @@ where V: borsh::ser::BorshSerialize, U: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { A::B { .. } => 0u8, @@ -31,4 +31,3 @@ where Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/check_serialize_with_attr.snap b/borsh-derive/src/internals/serialize/enums/snapshots/check_serialize_with_attr.snap index 33d2795be..29f1619c1 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/check_serialize_with_attr.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/check_serialize_with_attr.snap @@ -7,9 +7,9 @@ where K: borsh::ser::BorshSerialize, V: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { C::C3(..) => 0u8, @@ -29,4 +29,3 @@ where Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/generic_borsh_skip_struct_field.snap b/borsh-derive/src/internals/serialize/enums/snapshots/generic_borsh_skip_struct_field.snap index 495a19a49..051033a64 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/generic_borsh_skip_struct_field.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/generic_borsh_skip_struct_field.snap @@ -8,9 +8,9 @@ where K: borsh::ser::BorshSerialize, U: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { A::B { .. } => 0u8, @@ -29,4 +29,3 @@ where Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/generic_borsh_skip_tuple_field.snap b/borsh-derive/src/internals/serialize/enums/snapshots/generic_borsh_skip_tuple_field.snap index 75a282936..4f0ae41b7 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/generic_borsh_skip_tuple_field.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/generic_borsh_skip_tuple_field.snap @@ -8,9 +8,9 @@ where K: borsh::ser::BorshSerialize, V: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { A::B { .. } => 0u8, @@ -29,4 +29,3 @@ where Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/generic_serialize_bound.snap b/borsh-derive/src/internals/serialize/enums/snapshots/generic_serialize_bound.snap index 687b35590..1e53690ec 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/generic_serialize_bound.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/generic_serialize_bound.snap @@ -7,9 +7,9 @@ where T: borsh::ser::BorshSerialize + PartialOrd, U: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { A::C { .. } => 0u8, @@ -29,4 +29,3 @@ where Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/mixed_with_unit_variants.snap b/borsh-derive/src/internals/serialize/enums/snapshots/mixed_with_unit_variants.snap index 6de338b4b..69a56d5b9 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/mixed_with_unit_variants.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/mixed_with_unit_variants.snap @@ -3,9 +3,9 @@ source: borsh-derive/src/internals/serialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::ser::BorshSerialize for X { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { X::A(..) => 0u8, @@ -27,4 +27,3 @@ impl borsh::ser::BorshSerialize for X { Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/recursive_enum.snap b/borsh-derive/src/internals/serialize/enums/snapshots/recursive_enum.snap index 2387e0c83..d7aeab233 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/recursive_enum.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/recursive_enum.snap @@ -8,9 +8,9 @@ where K: borsh::ser::BorshSerialize, V: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { A::B { .. } => 0u8, @@ -30,4 +30,3 @@ where Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/simple_enum_with_custom_crate.snap b/borsh-derive/src/internals/serialize/enums/snapshots/simple_enum_with_custom_crate.snap index 09de52a72..fcfc55df6 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/simple_enum_with_custom_crate.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/simple_enum_with_custom_crate.snap @@ -3,9 +3,9 @@ source: borsh-derive/src/internals/serialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl reexporter::borsh::ser::BorshSerialize for AB { - fn serialize( + fn serialize<__W: reexporter::borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), reexporter::borsh::io::Error> { let variant_idx: u8 = match self { AB::B { .. } => 0u8, @@ -24,4 +24,3 @@ impl reexporter::borsh::ser::BorshSerialize for AB { Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/simple_generics.snap b/borsh-derive/src/internals/serialize/enums/snapshots/simple_generics.snap index c6d201d84..70e2f6498 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/simple_generics.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/simple_generics.snap @@ -8,9 +8,9 @@ where V: borsh::ser::BorshSerialize, U: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { A::B { .. } => 0u8, @@ -30,4 +30,3 @@ where Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/enums/snapshots/struct_variant_field.snap b/borsh-derive/src/internals/serialize/enums/snapshots/struct_variant_field.snap index 508ee24e4..0ba345286 100644 --- a/borsh-derive/src/internals/serialize/enums/snapshots/struct_variant_field.snap +++ b/borsh-derive/src/internals/serialize/enums/snapshots/struct_variant_field.snap @@ -3,9 +3,9 @@ source: borsh-derive/src/internals/serialize/enums/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::ser::BorshSerialize for AB { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { let variant_idx: u8 = match self { AB::B { .. } => 0u8, @@ -24,4 +24,3 @@ impl borsh::ser::BorshSerialize for AB { Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/mod.rs b/borsh-derive/src/internals/serialize/structs/mod.rs index 3ce362467..2864c78e9 100644 --- a/borsh-derive/src/internals/serialize/structs/mod.rs +++ b/borsh-derive/src/internals/serialize/structs/mod.rs @@ -35,7 +35,7 @@ pub fn process(input: &ItemStruct, cratename: Path) -> syn::Result Ok(quote! { impl #impl_generics #cratename::ser::BorshSerialize for #name #ty_generics #where_clause { - fn serialize(&self, writer: &mut W) -> ::core::result::Result<(), #cratename::io::Error> { + fn serialize<__W: #cratename::io::Write>(&self, writer: &mut __W) -> ::core::result::Result<(), #cratename::io::Error> { #body Ok(()) } diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/bound_generics.snap b/borsh-derive/src/internals/serialize/structs/snapshots/bound_generics.snap index c85a000f1..5c7c6926b 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/bound_generics.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/bound_generics.snap @@ -8,13 +8,12 @@ where K: borsh::ser::BorshSerialize, V: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { borsh::BorshSerialize::serialize(&self.x, writer)?; borsh::BorshSerialize::serialize(&self.y, writer)?; Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/check_serialize_with_attr.snap b/borsh-derive/src/internals/serialize/structs/snapshots/check_serialize_with_attr.snap index 963dfcee6..6d977d521 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/check_serialize_with_attr.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/check_serialize_with_attr.snap @@ -7,13 +7,12 @@ where K: borsh::ser::BorshSerialize, V: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { third_party_impl::serialize_third_party(&self.x, writer)?; borsh::BorshSerialize::serialize(&self.y, writer)?; Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/generic_associated_type.snap b/borsh-derive/src/internals/serialize/structs/snapshots/generic_associated_type.snap index b35b0ee3c..33b203f80 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/generic_associated_type.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/generic_associated_type.snap @@ -8,13 +8,12 @@ where T::Associated: borsh::ser::BorshSerialize, V: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { borsh::BorshSerialize::serialize(&self.field, writer)?; borsh::BorshSerialize::serialize(&self.another, writer)?; Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/generic_named_fields_struct_borsh_skip.snap b/borsh-derive/src/internals/serialize/structs/snapshots/generic_named_fields_struct_borsh_skip.snap index 8a95e2685..5351f166f 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/generic_named_fields_struct_borsh_skip.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/generic_named_fields_struct_borsh_skip.snap @@ -6,12 +6,11 @@ impl borsh::ser::BorshSerialize for G where U: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { borsh::BorshSerialize::serialize(&self.y, writer)?; Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/generic_serialize_bound.snap b/borsh-derive/src/internals/serialize/structs/snapshots/generic_serialize_bound.snap index 8b46520f1..c0309d69a 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/generic_serialize_bound.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/generic_serialize_bound.snap @@ -7,13 +7,12 @@ where T: borsh::ser::BorshSerialize + PartialOrd, U: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { borsh::BorshSerialize::serialize(&self.a, writer)?; borsh::BorshSerialize::serialize(&self.b, writer)?; Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/generic_tuple_struct_borsh_skip1.snap b/borsh-derive/src/internals/serialize/structs/snapshots/generic_tuple_struct_borsh_skip1.snap index ad07ce846..447fcb32e 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/generic_tuple_struct_borsh_skip1.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/generic_tuple_struct_borsh_skip1.snap @@ -6,12 +6,11 @@ impl borsh::ser::BorshSerialize for G where U: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { borsh::BorshSerialize::serialize(&self.1, writer)?; Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/generic_tuple_struct_borsh_skip2.snap b/borsh-derive/src/internals/serialize/structs/snapshots/generic_tuple_struct_borsh_skip2.snap index 0931db5bf..8c5800a25 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/generic_tuple_struct_borsh_skip2.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/generic_tuple_struct_borsh_skip2.snap @@ -7,12 +7,11 @@ where K: borsh::ser::BorshSerialize, V: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { borsh::BorshSerialize::serialize(&self.0, writer)?; Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/override_generic_associated_type_wrong_derive.snap b/borsh-derive/src/internals/serialize/structs/snapshots/override_generic_associated_type_wrong_derive.snap index 42c701c9e..9b2bf20b3 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/override_generic_associated_type_wrong_derive.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/override_generic_associated_type_wrong_derive.snap @@ -8,13 +8,12 @@ where V: borsh::ser::BorshSerialize, ::Associated: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { borsh::BorshSerialize::serialize(&self.field, writer)?; borsh::BorshSerialize::serialize(&self.another, writer)?; Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/recursive_struct.snap b/borsh-derive/src/internals/serialize/structs/snapshots/recursive_struct.snap index c97e45a5b..510b71b77 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/recursive_struct.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/recursive_struct.snap @@ -3,13 +3,12 @@ source: borsh-derive/src/internals/serialize/structs/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::ser::BorshSerialize for CRecC { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { borsh::BorshSerialize::serialize(&self.a, writer)?; borsh::BorshSerialize::serialize(&self.b, writer)?; Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/simple_generic_tuple_struct.snap b/borsh-derive/src/internals/serialize/structs/snapshots/simple_generic_tuple_struct.snap index e7939c1ed..984defae9 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/simple_generic_tuple_struct.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/simple_generic_tuple_struct.snap @@ -6,13 +6,12 @@ impl borsh::ser::BorshSerialize for TupleA where T: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { borsh::BorshSerialize::serialize(&self.0, writer)?; borsh::BorshSerialize::serialize(&self.1, writer)?; Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/simple_generics.snap b/borsh-derive/src/internals/serialize/structs/snapshots/simple_generics.snap index bca9544e5..3518ba3a4 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/simple_generics.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/simple_generics.snap @@ -7,13 +7,12 @@ where K: borsh::ser::BorshSerialize, V: borsh::ser::BorshSerialize, { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { borsh::BorshSerialize::serialize(&self.x, writer)?; borsh::BorshSerialize::serialize(&self.y, writer)?; Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/simple_struct.snap b/borsh-derive/src/internals/serialize/structs/snapshots/simple_struct.snap index 557d9ded2..8904dca85 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/simple_struct.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/simple_struct.snap @@ -3,13 +3,12 @@ source: borsh-derive/src/internals/serialize/structs/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl borsh::ser::BorshSerialize for A { - fn serialize( + fn serialize<__W: borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), borsh::io::Error> { borsh::BorshSerialize::serialize(&self.x, writer)?; borsh::BorshSerialize::serialize(&self.y, writer)?; Ok(()) } } - diff --git a/borsh-derive/src/internals/serialize/structs/snapshots/simple_struct_with_custom_crate.snap b/borsh-derive/src/internals/serialize/structs/snapshots/simple_struct_with_custom_crate.snap index c06c46f8c..bd331f30d 100644 --- a/borsh-derive/src/internals/serialize/structs/snapshots/simple_struct_with_custom_crate.snap +++ b/borsh-derive/src/internals/serialize/structs/snapshots/simple_struct_with_custom_crate.snap @@ -3,13 +3,12 @@ source: borsh-derive/src/internals/serialize/structs/mod.rs expression: pretty_print_syn_str(&actual).unwrap() --- impl reexporter::borsh::ser::BorshSerialize for A { - fn serialize( + fn serialize<__W: reexporter::borsh::io::Write>( &self, - writer: &mut W, + writer: &mut __W, ) -> ::core::result::Result<(), reexporter::borsh::io::Error> { reexporter::borsh::BorshSerialize::serialize(&self.x, writer)?; reexporter::borsh::BorshSerialize::serialize(&self.y, writer)?; Ok(()) } } - diff --git a/borsh/tests/test_generic_struct.rs b/borsh/tests/test_generic_struct.rs index d96d1ce4f..7f87898c2 100644 --- a/borsh/tests/test_generic_struct.rs +++ b/borsh/tests/test_generic_struct.rs @@ -36,17 +36,17 @@ struct A { } #[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug)] -enum B { - X { f: Vec }, +enum B { + X { f: Vec }, Y(G), } #[derive(BorshSerialize, BorshDeserialize, Debug)] -struct TupleA(T, u32); +struct TupleA(W, u32); #[derive(BorshSerialize, BorshDeserialize, Debug)] -struct NamedA { - a: T, +struct NamedA { + a: W, b: u32, } @@ -84,9 +84,9 @@ struct C2 { /// `T: Ord` bound is required for `BorshDeserialize` derive to be successful #[derive(BorshSerialize, BorshDeserialize)] -struct D { +struct D { a: String, - b: BTreeMap, + b: BTreeMap, } #[cfg(hash_collections)] @@ -99,7 +99,7 @@ struct G1(#[borsh(skip)] HashMap, U); #[cfg(hash_collections)] #[derive(BorshDeserialize)] -struct G2(HashMap, #[borsh(skip)] U); +struct G2(HashMap, #[borsh(skip)] U); /// implicit derived `core::default::Default` bounds on `K` and `V` are dropped by empty bound /// specified, as `HashMap` hash its own `Default` implementation @@ -118,27 +118,27 @@ struct H { /// `T: Ord` bound is required for `BorshDeserialize` derive to be successful #[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug)] -enum E { +enum E { X { f: BTreeMap }, - Y(G), + Y(W), } #[cfg(hash_collections)] #[derive(BorshSerialize, BorshDeserialize, Debug)] -enum I1 { +enum I1 { B { #[allow(unused)] #[borsh(skip)] x: HashMap, y: String, }, - C(K, Vec), + C(K, Vec), } #[cfg(hash_collections)] #[derive(BorshSerialize, BorshDeserialize, Debug)] -enum I2 { - B { x: HashMap, y: String }, +enum I2 { + B { x: HashMap, y: String }, C(K, #[borsh(skip)] U), }