Skip to content

Commit

Permalink
fix for &str
Browse files Browse the repository at this point in the history
  • Loading branch information
Ten0 committed Mar 10, 2024
1 parent 0348c36 commit 0068b24
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion serde_avro_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl SchemaBuilder {
idx
}

pub fn find_or_build<T: BuildSchema>(&mut self) -> SchemaKey {
pub fn find_or_build<T: BuildSchema + ?Sized>(&mut self) -> SchemaKey {
match self
.already_built_types
.entry(TypeId::of::<T::TypeLookup>())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ fn complex() {
struct Generics<'a, F> {
s1: F,
s2: &'a F,
s: &'a str,
}

#[test]
Expand Down
5 changes: 2 additions & 3 deletions serde_avro_derive_macros/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ pub(crate) fn schema_impl(input: SchemaDeriveInput) -> Result<TokenStream, Error
// 'static otherwise it won't implement `Any`, so we need to generate a
// dedicated struct for it.
let type_lookup_ident = format_ident!("{ident}TypeLookup");
let type_params: Vec<syn::Ident> = (0..generics.params.len())
.map(|i| format_ident!("T{}", i))
.collect();
let type_params: Vec<syn::Ident> =
(0..fields.len()).map(|i| format_ident!("T{}", i)).collect();
let struct_decl = syn::ItemStruct {
attrs: Default::default(),
vis: syn::Visibility::Inherited,
Expand Down

0 comments on commit 0068b24

Please sign in to comment.