1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
// run-pass // compile-flags: -C opt-level=3 -Zvalidate-mir fn return_result() -> Option<String> { Some("ok".to_string()) } fn start() -> String { let Some(content) = return_result() else { return "none".to_string() }; content } fn main() { start(); }