Skip to content
Snippets Groups Projects
Commit 0d65a936 authored by Gavin Wood's avatar Gavin Wood Committed by GitHub
Browse files

Remove unneeded `Ord` bound from All, Contains supports tuples (#8691)

* Remove unneeded `Ord` bound from All

* Fixes

* Contains supports tuples
parent a7facf25
No related merge requests found
......@@ -27,10 +27,20 @@ pub trait Contains<T> {
/// A `Contains` implementation which always returns `true`.
pub struct All<T>(PhantomData<T>);
impl<T: Ord> Contains<T> for All<T> {
impl<T> Contains<T> for All<T> {
fn contains(_: &T) -> bool { true }
}
#[impl_trait_for_tuples::impl_for_tuples(30)]
impl<T> Contains<T> 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]
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment