Skip to content

Commit 8af08e7

Browse files
benlueloordian
authored andcommitted
feat(frame-support-procedural): add automaticaly_derived attr to NoBound derives (#2197)
fixes #2196
1 parent ba4c74d commit 8af08e7

File tree

5 files changed

+7
-0
lines changed

5 files changed

+7
-0
lines changed

substrate/frame/support/procedural/src/no_bound/clone.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ pub fn derive_clone_no_bound(input: proc_macro::TokenStream) -> proc_macro::Toke
9898

9999
quote::quote!(
100100
const _: () = {
101+
#[automatically_derived]
101102
impl #impl_generics ::core::clone::Clone for #name #ty_generics #where_clause {
102103
fn clone(&self) -> Self {
103104
#impl_

substrate/frame/support/procedural/src/no_bound/debug.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ pub fn derive_debug_no_bound(input: proc_macro::TokenStream) -> proc_macro::Toke
112112

113113
quote::quote!(
114114
const _: () = {
115+
#[automatically_derived]
115116
impl #impl_generics ::core::fmt::Debug for #input_ident #ty_generics #where_clause {
116117
fn fmt(&self, fmt: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
117118
#impl_

substrate/frame/support/procedural/src/no_bound/default.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ pub fn derive_default_no_bound(input: proc_macro::TokenStream) -> proc_macro::To
149149

150150
quote!(
151151
const _: () = {
152+
#[automatically_derived]
152153
impl #impl_generics ::core::default::Default for #name #ty_generics #where_clause {
153154
fn default() -> Self {
154155
#impl_

substrate/frame/support/procedural/src/no_bound/partial_eq.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ pub fn derive_partial_eq_no_bound(input: proc_macro::TokenStream) -> proc_macro:
128128

129129
quote::quote!(
130130
const _: () = {
131+
#[automatically_derived]
131132
impl #impl_generics ::core::cmp::PartialEq for #name #ty_generics #where_clause {
132133
fn eq(&self, other: &Self) -> bool {
133134
#impl_

substrate/frame/support/test/tests/derive_no_bound.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ struct StructNoGenerics {
136136
field2: u64,
137137
}
138138

139+
#[allow(dead_code)]
139140
#[derive(DebugNoBound, CloneNoBound, EqNoBound, PartialEqNoBound, DefaultNoBound)]
140141
enum EnumNoGenerics {
141142
#[default]
@@ -162,6 +163,7 @@ enum Enum<T: Config, U, V> {
162163
}
163164

164165
// enum that will have a named default.
166+
#[allow(dead_code)]
165167
#[derive(DebugNoBound, CloneNoBound, EqNoBound, PartialEqNoBound, DefaultNoBound)]
166168
enum Enum2<T: Config> {
167169
#[default]
@@ -175,6 +177,7 @@ enum Enum2<T: Config> {
175177
VariantUnit2,
176178
}
177179

180+
#[allow(dead_code)]
178181
// enum that will have a unit default.
179182
#[derive(DebugNoBound, CloneNoBound, EqNoBound, PartialEqNoBound, DefaultNoBound)]
180183
enum Enum3<T: Config> {

0 commit comments

Comments
 (0)