diff --git a/src/combinations.rs b/src/combinations.rs index f409775..d0ca8c9 100644 --- a/src/combinations.rs +++ b/src/combinations.rs @@ -144,8 +144,7 @@ where fn traverse(&self, thing: T) -> Vec { let a = A::traverse(&self.0 .0, thing); a.into_iter() - .map(|v| B::traverse(&self.1 .0, v)) - .flatten() + .flat_map(|v| B::traverse(&self.1 .0, v)) .collect() } } diff --git a/src/lib.rs b/src/lib.rs index c320aa8..29c280a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ #![feature(unboxed_closures, fn_traits, const_trait_impl)] +#![allow(clippy::type_complexity)] pub mod combinations; mod fns; diff --git a/src/prisms/mod.rs b/src/prisms/mod.rs index caeff7f..762d5c2 100644 --- a/src/prisms/mod.rs +++ b/src/prisms/mod.rs @@ -21,11 +21,7 @@ pub trait PrismPreview { F: FnOnce(Self::Field) -> Self::Field, T: Clone, { - if let Some(a) = Self::preview(&self, thing.clone()) { - Self::review(&self, f(a)) - } else { - thing - } + Self::preview(self, thing.clone()).map_or(thing, |a| Self::review(self, f(a))) } fn set(&self, thing: T, v: Self::Field) -> T @@ -33,7 +29,7 @@ pub trait PrismPreview { T: Clone, Self::Field: Clone, { - Self::over(self, thing, move |_| v.clone()) + Self::over(self, thing, move |_| v) } }