Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frame-support-procedural): add automaticaly_derived attr to NoBound derives #2197

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions substrate/frame/support/procedural/src/no_bound/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ pub fn derive_clone_no_bound(input: proc_macro::TokenStream) -> proc_macro::Toke

quote::quote!(
const _: () = {
#[automatically_derived]
impl #impl_generics ::core::clone::Clone for #name #ty_generics #where_clause {
fn clone(&self) -> Self {
#impl_
Expand Down
1 change: 1 addition & 0 deletions substrate/frame/support/procedural/src/no_bound/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ pub fn derive_debug_no_bound(input: proc_macro::TokenStream) -> proc_macro::Toke

quote::quote!(
const _: () = {
#[automatically_derived]
impl #impl_generics ::core::fmt::Debug for #input_ident #ty_generics #where_clause {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
#impl_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pub fn derive_default_no_bound(input: proc_macro::TokenStream) -> proc_macro::To

quote!(
const _: () = {
#[automatically_derived]
impl #impl_generics ::core::default::Default for #name #ty_generics #where_clause {
fn default() -> Self {
#impl_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ pub fn derive_partial_eq_no_bound(input: proc_macro::TokenStream) -> proc_macro:

quote::quote!(
const _: () = {
#[automatically_derived]
impl #impl_generics ::core::cmp::PartialEq for #name #ty_generics #where_clause {
fn eq(&self, other: &Self) -> bool {
#impl_
Expand Down
3 changes: 3 additions & 0 deletions substrate/frame/support/test/tests/derive_no_bound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ struct StructNoGenerics {
field2: u64,
}

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

// enum that will have a named default.
#[allow(dead_code)]
#[derive(DebugNoBound, CloneNoBound, EqNoBound, PartialEqNoBound, DefaultNoBound)]
enum Enum2<T: Config> {
#[default]
Expand All @@ -175,6 +177,7 @@ enum Enum2<T: Config> {
VariantUnit2,
}

#[allow(dead_code)]
// enum that will have a unit default.
#[derive(DebugNoBound, CloneNoBound, EqNoBound, PartialEqNoBound, DefaultNoBound)]
enum Enum3<T: Config> {
Expand Down
Loading