if let Some(ref s) = s { (x.clone(), s) } else { panic!() }
});
+ // Issue #7820
unsafe fn f(x: u32) -> u32 {
x
}
let _ = Some(0).map(|x| f(x));
}
let _ = Some(0).map(|x| unsafe { f(x) });
+ let _ = Some(0).map(|x| unsafe { f(x) });
}
None => None,
};
+ // Issue #7820
unsafe fn f(x: u32) -> u32 {
x
}
Some(x) => unsafe { Some(f(x)) },
None => None,
};
+ let _ = match Some(0) {
+ Some(x) => Some(unsafe { f(x) }),
+ None => None,
+ };
}
|
error: manual implementation of `Option::map`
- --> $DIR/manual_map_option_2.rs:61:17
+ --> $DIR/manual_map_option_2.rs:62:17
|
LL | let _ = match Some(0) {
| _________________^
| |_________^ help: try this: `Some(0).map(|x| f(x))`
error: manual implementation of `Option::map`
- --> $DIR/manual_map_option_2.rs:66:13
+ --> $DIR/manual_map_option_2.rs:67:13
|
LL | let _ = match Some(0) {
| _____________^
LL | | };
| |_____^ help: try this: `Some(0).map(|x| unsafe { f(x) })`
-error: aborting due to 4 previous errors
+error: manual implementation of `Option::map`
+ --> $DIR/manual_map_option_2.rs:71:13
+ |
+LL | let _ = match Some(0) {
+ | _____________^
+LL | | Some(x) => Some(unsafe { f(x) }),
+LL | | None => None,
+LL | | };
+ | |_____^ help: try this: `Some(0).map(|x| unsafe { f(x) })`
+
+error: aborting due to 5 previous errors