diff options
Diffstat (limited to 'src/ops')
-rw-r--r-- | src/ops/and.rs | 2 | ||||
-rw-r--r-- | src/ops/bool.rs | 4 | ||||
-rw-r--r-- | src/ops/failable.rs | 8 | ||||
-rw-r--r-- | src/ops/map.rs | 9 | ||||
-rw-r--r-- | src/ops/mod.rs | 4 | ||||
-rw-r--r-- | src/ops/not.rs | 2 | ||||
-rw-r--r-- | src/ops/or.rs | 2 | ||||
-rw-r--r-- | src/ops/xor.rs | 2 |
8 files changed, 12 insertions, 21 deletions
diff --git a/src/ops/and.rs b/src/ops/and.rs index eb9f347..ce3f284 100644 --- a/src/ops/and.rs +++ b/src/ops/and.rs @@ -16,11 +16,9 @@ use filter::Filter; pub struct And<T, U>(T, U); impl<T, U> And<T, U> { - pub fn new(a: T, b: U) -> And<T, U> { And(a, b) } - } impl_operators!(And, self e { self.0.filter(e) && self.1.filter(e) }, T, U); diff --git a/src/ops/bool.rs b/src/ops/bool.rs index 23c662b..fcf8e7f 100644 --- a/src/ops/bool.rs +++ b/src/ops/bool.rs @@ -16,19 +16,15 @@ use filter::Filter; pub struct Bool(bool); impl Bool { - pub fn new(b: bool) -> Bool { Bool(b) } - } impl From<bool> for Bool { - fn from(b: bool) -> Bool { Bool::new(b) } - } impl_operators!(Bool, self e { self.0 }, ); diff --git a/src/ops/failable.rs b/src/ops/failable.rs index 1b4ca22..0e734d8 100644 --- a/src/ops/failable.rs +++ b/src/ops/failable.rs @@ -10,8 +10,8 @@ //! shouldn't be necessary. //! -use filter::Filter; use failable::filter::FailableFilter; +use filter::Filter; #[must_use = "filters are lazy and do nothing unless consumed"] #[derive(Clone)] @@ -24,7 +24,8 @@ impl<F> IntoFailable<F> { } impl<F, N> FailableFilter<N> for IntoFailable<F> - where F: Filter<N>, +where + F: Filter<N>, { type Error = (); @@ -44,7 +45,8 @@ impl<'a, F: 'a + ?Sized> AsFailable<'a, F> { } impl<'a, F, N> FailableFilter<N> for AsFailable<'a, F> - where F: Filter<N> + 'a + ?Sized, +where + F: Filter<N> + 'a + ?Sized, { type Error = (); diff --git a/src/ops/map.rs b/src/ops/map.rs index bc8e59f..5726327 100644 --- a/src/ops/map.rs +++ b/src/ops/map.rs @@ -9,8 +9,8 @@ //! Will be automatically included when including `filter::Filter`, so importing this module //! shouldn't be necessary. //! -use std::marker::PhantomData; use std::borrow::Borrow; +use std::marker::PhantomData; use filter::Filter; @@ -25,9 +25,10 @@ impl<F, M, FT, B> MapInput<F, M, FT, B> { } impl<FT, F, T, B, M> Filter<T> for MapInput<F, M, FT, B> - where F: Filter<FT>, - B: Borrow<FT> + Sized, - M: Fn(&T) -> B +where + F: Filter<FT>, + B: Borrow<FT> + Sized, + M: Fn(&T) -> B, { fn filter(&self, e: &T) -> bool { self.0.filter(self.1(e).borrow()) diff --git a/src/ops/mod.rs b/src/ops/mod.rs index 3964f88..8fd2e80 100644 --- a/src/ops/mod.rs +++ b/src/ops/mod.rs @@ -6,8 +6,8 @@ pub mod and; pub mod bool; +pub mod failable; +pub mod map; pub mod not; pub mod or; pub mod xor; -pub mod map; -pub mod failable; diff --git a/src/ops/not.rs b/src/ops/not.rs index bd65fcb..98e1971 100644 --- a/src/ops/not.rs +++ b/src/ops/not.rs @@ -16,11 +16,9 @@ use filter::Filter; pub struct Not<T>(T); impl<T> Not<T> { - pub fn new(a: T) -> Not<T> { Not(a) } - } impl_operators!(Not, self e { !self.0.filter(e) }, T); diff --git a/src/ops/or.rs b/src/ops/or.rs index 837c3df..b80022c 100644 --- a/src/ops/or.rs +++ b/src/ops/or.rs @@ -16,11 +16,9 @@ use filter::Filter; pub struct Or<T, U>(T, U); impl<T, U> Or<T, U> { - pub fn new(a: T, b: U) -> Or<T, U> { Or(a, b) } - } impl_operators!(Or, self e { self.0.filter(e) || self.1.filter(e) }, T, U); diff --git a/src/ops/xor.rs b/src/ops/xor.rs index b1cf8e5..af3dd08 100644 --- a/src/ops/xor.rs +++ b/src/ops/xor.rs @@ -16,11 +16,9 @@ use filter::Filter; pub struct XOr<T, U>(T, U); impl<T, U> XOr<T, U> { - pub fn new(a: T, b: U) -> XOr<T, U> { XOr(a, b) } - } impl_operators!(XOr, self e { self.0.filter(e) ^ self.1.filter(e) }, T, U); |