mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
431 B
19 lines
431 B
fn main() {
|
|
// ANCHOR: here
|
|
fn plus_one(x: Option<i32>) -> Option<i32> {
|
|
match x {
|
|
// ANCHOR: first_arm
|
|
None => None,
|
|
// ANCHOR_END: first_arm
|
|
// ANCHOR: second_arm
|
|
Some(i) => Some(i + 1),
|
|
// ANCHOR_END: second_arm
|
|
}
|
|
}
|
|
|
|
let five = Some(5);
|
|
let six = plus_one(five);
|
|
let none = plus_one(None);
|
|
// ANCHOR_END: here
|
|
}
|