Skip to content

Commit 23f251e

Browse files
get rid of PhantomData
1 parent 0779f1b commit 23f251e

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/lib.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#[cfg(feature = "std")]
4646
extern crate core;
4747

48-
use core::{cmp, marker::PhantomData};
48+
use core::cmp;
4949

5050
mod sources;
5151
pub use sources::{convert, Convert};
@@ -600,15 +600,12 @@ pub trait StreamingIteratorMut: StreamingIterator {
600600

601601
/// Creates an iterator which flattens nested streaming iterators.
602602
#[inline]
603-
fn flatten(self) -> Flatten<Self, Self::Item>
603+
fn flatten(self) -> Flatten<Self>
604604
where
605605
Self: Sized,
606606
Self::Item: StreamingIterator + Sized,
607607
{
608-
Flatten {
609-
iter: self,
610-
_inner: PhantomData,
611-
}
608+
Flatten { iter: self }
612609
}
613610
}
614611

@@ -1279,15 +1276,14 @@ where
12791276

12801277
/// A streaming iterator that flattens nested streaming iterators.
12811278
#[derive(Debug)]
1282-
pub struct Flatten<I, J> {
1279+
pub struct Flatten<I> {
12831280
iter: I,
1284-
_inner: PhantomData<J>,
12851281
}
12861282

1287-
impl<I, J> StreamingIterator for Flatten<I, J>
1283+
impl<I, J> StreamingIterator for Flatten<I>
12881284
where
12891285
I: StreamingIteratorMut<Item = J>,
1290-
J: StreamingIterator,
1286+
for<'a> J: StreamingIterator + 'a,
12911287
{
12921288
type Item = J::Item;
12931289

@@ -1321,10 +1317,10 @@ where
13211317
}
13221318
}
13231319

1324-
impl<I, J> StreamingIteratorMut for Flatten<I, J>
1320+
impl<I, J> StreamingIteratorMut for Flatten<I>
13251321
where
13261322
I: StreamingIteratorMut<Item = J>,
1327-
J: StreamingIteratorMut,
1323+
for<'a> J: StreamingIteratorMut + 'a,
13281324
{
13291325
#[inline]
13301326
fn get_mut(&mut self) -> Option<&mut Self::Item> {

0 commit comments

Comments
 (0)