update DefaultNoBound derive macro (#12723)

fix derive for empty enums

Update derive & ui tests

clean up

Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

rename variable

formatting & clippy

formatting

Co-authored-by: parity-processbot <>
This commit is contained in:
benlueloBastian Köcherparity-processbot
authored and GitHub committed 2022-11-25 11:11:19 +01:00
1 parent 08657f14b7
commit 50f338e1ea
13 files changed
+235 -61

No files matched your search

+11 -2
View File
@@ -621,14 +621,23 @@ pub use frame_support_procedural::DebugNoBound;
/// # use frame_support::DefaultNoBound;
/// # use core::default::Default;
/// trait Config {
/// type C: Default;
/// type C: Default;
/// }
///
/// // Foo implements [`Default`] because `C` bounds [`Default`].
/// // Otherwise compilation will fail with an output telling `c` doesn't implement [`Default`].
/// #[derive(DefaultNoBound)]
/// struct Foo<T: Config> {
/// c: T::C,
/// c: T::C,
/// }
///
/// // Also works with enums, by specifying the default with #[default]:
/// #[derive(DefaultNoBound)]
/// enum Bar<T: Config> {
/// // Bar will implement Default as long as all of the types within Baz also implement default.
/// #[default]
/// Baz(T::C),
/// Quxx,
/// }
/// ```
pub use frame_support_procedural::DefaultNoBound;