]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/simple_option_map_e2e.rs
Rollup merge of #106766 - GuillaumeGomez:rm-stripper-dead-code, r=notriddle
[rust.git] / tests / mir-opt / simple_option_map_e2e.rs
1 #[inline(always)]
2 fn map<T, U, F>(slf: Option<T>, f: F) -> Option<U>
3 where
4     F: FnOnce(T) -> U,
5 {
6     match slf {
7         Some(x) => Some(f(x)),
8         None => None,
9     }
10 }
11
12 // EMIT_MIR simple_option_map_e2e.ezmap.PreCodegen.after.mir
13 pub fn ezmap(x: Option<i32>) -> Option<i32> {
14     map(x, |n| n + 1)
15 }
16
17 fn main() {
18     assert_eq!(None, ezmap(None));
19 }