From fe88d800c31606c7097ba38a9bf77b0beefdc4fe Mon Sep 17 00:00:00 2001 From: Luiz Carvalho Date: Fri, 14 Feb 2025 08:04:51 -0300 Subject: [PATCH 1/4] chore: mark TypeInfo derived impl as automatically_derived As per rust-lang/rust#120185, functions with their enclosing impl body marked as `#[automatically_derived]` won't be featured in coverage reports. --- derive/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 8d1db093..fe7c0652 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -110,6 +110,7 @@ impl TypeInfoImpl { }); Ok(quote! { + #[automatically_derived] impl #impl_generics #scale_info::TypeInfo for #ident #ty_generics #where_clause { type Identity = Self; fn type_info() -> #scale_info::Type { From db9810db9c7dfd7e8bb0869b1225c5b89ebf242d Mon Sep 17 00:00:00 2001 From: Luiz Carvalho Date: Fri, 14 Feb 2025 12:13:14 -0300 Subject: [PATCH 2/4] chore: elide lifetimes --- derive/src/trait_bounds.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/derive/src/trait_bounds.rs b/derive/src/trait_bounds.rs index d2faf94d..a65e5424 100644 --- a/derive/src/trait_bounds.rs +++ b/derive/src/trait_bounds.rs @@ -121,7 +121,7 @@ fn type_contains_idents(ty: &Type, idents: &[Ident]) -> bool { idents: &'a [Ident], } - impl<'a, 'ast> Visit<'ast> for ContainIdents<'a> { + impl<'ast> Visit<'ast> for ContainIdents<'_> { fn visit_ident(&mut self, i: &'ast Ident) { if self.idents.iter().any(|id| id == i) { self.result = true; @@ -145,7 +145,7 @@ fn type_or_sub_type_path_starts_with_ident(ty: &Type, ident: &Ident) -> bool { ident: &'a Ident, } - impl<'a, 'ast> Visit<'ast> for TypePathStartsWithIdent<'a> { + impl<'ast> Visit<'ast> for TypePathStartsWithIdent<'_> { fn visit_type_path(&mut self, i: &'ast TypePath) { if i.qself.is_none() { if let Some(segment) = i.path.segments.first() { From d6921ee08a8dbfa5f4f09ec906226c00098079b3 Mon Sep 17 00:00:00 2001 From: Luiz Carvalho Date: Fri, 14 Feb 2025 15:34:55 -0300 Subject: [PATCH 3/4] Update tests.rs paritytech/parity-scale-codec/pull/653 disallowed duplicate indexes for variants. --- src/tests.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests.rs b/src/tests.rs index 115f46f8..5361b890 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -294,7 +294,7 @@ fn basic_enum_with_index() { #[allow(unused)] #[derive(Encode)] enum IndexedRustEnum { - #[codec(index = 3)] + #[codec(index = 4)] A(bool), #[codec(index = 0)] B { @@ -312,7 +312,7 @@ fn basic_enum_with_index() { .variant( Variants::new() .variant("A", |v| { - v.index(3).fields( + v.index(4).fields( Fields::unnamed().field(|f| f.ty::().type_name("bool")), ) }) @@ -338,7 +338,7 @@ fn basic_enum_with_index() { .variant( Variants::new() .variant("A", |v| { - v.index(3) + v.index(4) .fields(Fields::unnamed().field(|f| f.ty::().type_name("bool"))) }) .variant("B", |v| { From 0af353d06cac99589aad93347fbdf6b22a4c3ef4 Mon Sep 17 00:00:00 2001 From: Luiz Carvalho Date: Tue, 18 Feb 2025 09:14:15 -0300 Subject: [PATCH 4/4] fix: ui tests were outdated --- test_suite/tests/ui/fail_missing_derive.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_suite/tests/ui/fail_missing_derive.stderr b/test_suite/tests/ui/fail_missing_derive.stderr index 31c3cba2..4183c20e 100644 --- a/test_suite/tests/ui/fail_missing_derive.stderr +++ b/test_suite/tests/ui/fail_missing_derive.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `PawType: TypeInfo` is not satisfied --> tests/ui/fail_missing_derive.rs:19:24 | 19 | assert_type_info::>(); - | ^^^^^^^^^^^^^^^^^^ the trait `TypeInfo` is not implemented for `PawType`, which is required by `Cat: TypeInfo` + | ^^^^^^^^^^^^^^^^^^ the trait `TypeInfo` is not implemented for `PawType` | = help: the following other types implement trait `TypeInfo`: &T