From 0d65a936d2345caeeb11442781c6ea90c7b4b9ed Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Wed, 28 Apr 2021 18:25:00 +0200 Subject: [PATCH] Remove unneeded `Ord` bound from All, Contains supports tuples (#8691) * Remove unneeded `Ord` bound from All * Fixes * Contains supports tuples --- substrate/frame/support/src/traits/members.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/substrate/frame/support/src/traits/members.rs b/substrate/frame/support/src/traits/members.rs index 125f096fa9..8b9c2c90f5 100644 --- a/substrate/frame/support/src/traits/members.rs +++ b/substrate/frame/support/src/traits/members.rs @@ -27,10 +27,20 @@ pub trait Contains { /// A `Contains` implementation which always returns `true`. pub struct All(PhantomData); -impl Contains for All { +impl Contains for All { fn contains(_: &T) -> bool { true } } +#[impl_trait_for_tuples::impl_for_tuples(30)] +impl Contains for Tuple { + fn contains(t: &T) -> bool { + for_tuples!( #( + if Tuple::contains(t) { return true } + )* ); + false + } +} + /// Create a type which implements the `Contains` trait for a particular type with syntax similar /// to `matches!`. #[macro_export]