Skip to content

Commit

Permalink
MapInto: relax Debug/Clone bounds
Browse files Browse the repository at this point in the history
Derive those adds a bound on `U` which is not needed since it's only `PhantomData`.
Note that `PhantomData<T>` is `Debug` for any `T`.
  • Loading branch information
Philippe-Cholet authored and jswrenn committed Feb 28, 2024
1 parent 3918da2 commit 6b931e5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/adaptors/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,19 @@ impl<T: Into<U>, U> MapSpecialCaseFn<T> for MapSpecialCaseFnInto<U> {
}
}

#[derive(Clone, Debug)]
pub struct MapSpecialCaseFnInto<U>(PhantomData<U>);

impl<U> std::fmt::Debug for MapSpecialCaseFnInto<U> {
debug_fmt_fields!(MapSpecialCaseFnInto, 0);
}

impl<U> Clone for MapSpecialCaseFnInto<U> {
#[inline]
fn clone(&self) -> Self {
Self(PhantomData)
}
}

/// Create a new [`MapInto`] iterator.
pub fn map_into<I, R>(iter: I) -> MapInto<I, R> {
MapSpecialCase {
Expand Down

0 comments on commit 6b931e5

Please sign in to comment.