File tree 2 files changed +1
-6
lines changed
2 files changed +1
-6
lines changed Original file line number Diff line number Diff line change 55
55
/// Using `identity` to do nothing among other interesting functions:
56
56
///
57
57
/// ```rust
58
- /// #![feature(convert_id)]
59
58
/// use std::convert::identity;
60
59
///
61
60
/// fn manipulation(x: u32) -> u32 {
69
68
/// Using `identity` to get a function that changes nothing in a conditional:
70
69
///
71
70
/// ```rust
72
- /// #![feature(convert_id)]
73
71
/// use std::convert::identity;
74
72
///
75
73
/// # let condition = true;
86
84
/// Using `identity` to keep the `Some` variants of an iterator of `Option<T>`:
87
85
///
88
86
/// ```rust
89
- /// #![feature(convert_id)]
90
87
/// use std::convert::identity;
91
88
///
92
89
/// let iter = vec![Some(1), None, Some(3)].into_iter();
93
90
/// let filtered = iter.filter_map(identity).collect::<Vec<_>>();
94
91
/// assert_eq!(vec![1, 3], filtered);
95
92
/// ```
96
- #[ unstable ( feature = "convert_id" , issue = "53500 " ) ]
93
+ #[ stable ( feature = "convert_id" , since = "1.33.0 " ) ]
97
94
#[ inline]
98
95
pub const fn identity < T > ( x : T ) -> T { x }
99
96
Original file line number Diff line number Diff line change 2
2
3
3
// compile-pass
4
4
5
- #![ feature( convert_id) ]
6
-
7
5
fn main ( ) {
8
6
const _FOO: u8 = :: std:: convert:: identity ( 42u8 ) ;
9
7
}
You can’t perform that action at this time.
0 commit comments