Skip to content

Commit 38de0bf

Browse files
committed
Use std::convert::identity
1 parent 134089a commit 38de0bf

File tree

4 files changed

+6
-26
lines changed

4 files changed

+6
-26
lines changed

Diff for: src/option/from_stream.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::pin::Pin;
22

33
use crate::prelude::*;
44
use crate::stream::{FromStream, IntoStream};
5-
use crate::utils::identity;
5+
use std::convert::identity;
66

77
impl<T, V> FromStream<Option<T>> for Option<V>
88
where
@@ -33,11 +33,7 @@ where
3333
.collect()
3434
.await;
3535

36-
if found_none {
37-
None
38-
} else {
39-
Some(out)
40-
}
36+
if found_none { None } else { Some(out) }
4137
})
4238
}
4339
}

Diff for: src/option/product.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::pin::Pin;
22

33
use crate::prelude::*;
44
use crate::stream::{Product, Stream};
5-
use crate::utils::identity;
5+
use std::convert::identity;
66

77
impl<T, U> Product<Option<U>> for Option<T>
88
where
@@ -57,11 +57,7 @@ where
5757
)
5858
.await;
5959

60-
if found_none {
61-
None
62-
} else {
63-
Some(out)
64-
}
60+
if found_none { None } else { Some(out) }
6561
})
6662
}
6763
}

Diff for: src/option/sum.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::pin::Pin;
22

33
use crate::prelude::*;
44
use crate::stream::{Stream, Sum};
5-
use crate::utils::identity;
5+
use std::convert::identity;
66

77
impl<T, U> Sum<Option<U>> for Option<T>
88
where
@@ -52,11 +52,7 @@ where
5252
)
5353
.await;
5454

55-
if found_none {
56-
None
57-
} else {
58-
Some(out)
59-
}
55+
if found_none { None } else { Some(out) }
6056
})
6157
}
6258
}

Diff for: src/utils.rs

-8
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ pub fn random(n: u32) -> u32 {
5252
})
5353
}
5454

55-
/// Returns given argument without changes.
56-
#[allow(dead_code)]
57-
#[doc(hidden)]
58-
#[inline(always)]
59-
pub(crate) fn identity<T>(arg: T) -> T {
60-
arg
61-
}
62-
6355
/// Add additional context to errors
6456
pub(crate) trait Context {
6557
fn context(self, message: impl Fn() -> String) -> Self;

0 commit comments

Comments
 (0)