File tree Expand file tree Collapse file tree 2 files changed +1
-6
lines changed Expand file tree Collapse file tree 2 files changed +1
-6
lines changed Original file line number Diff line number Diff line change 5555/// Using `identity` to do nothing among other interesting functions:
5656///
5757/// ```rust
58- /// #![feature(convert_id)]
5958/// use std::convert::identity;
6059///
6160/// fn manipulation(x: u32) -> u32 {
6968/// Using `identity` to get a function that changes nothing in a conditional:
7069///
7170/// ```rust
72- /// #![feature(convert_id)]
7371/// use std::convert::identity;
7472///
7573/// # let condition = true;
8684/// Using `identity` to keep the `Some` variants of an iterator of `Option<T>`:
8785///
8886/// ```rust
89- /// #![feature(convert_id)]
9087/// use std::convert::identity;
9188///
9289/// let iter = vec![Some(1), None, Some(3)].into_iter();
9390/// let filtered = iter.filter_map(identity).collect::<Vec<_>>();
9491/// assert_eq!(vec![1, 3], filtered);
9592/// ```
96- #[ unstable ( feature = "convert_id" , issue = "53500 " ) ]
93+ #[ stable ( feature = "convert_id" , since = "1.33.0 " ) ]
9794#[ inline]
9895pub const fn identity < T > ( x : T ) -> T { x }
9996
Original file line number Diff line number Diff line change 22
33// compile-pass
44
5- #![ feature( convert_id) ]
6-
75fn main ( ) {
86 const _FOO: u8 = :: std:: convert:: identity ( 42u8 ) ;
97}
You can’t perform that action at this time.
0 commit comments