diff --git a/src/error/option_unwrap/defaults.md b/src/error/option_unwrap/defaults.md index 4d3a60f9d6..4c1844a20c 100644 --- a/src/error/option_unwrap/defaults.md +++ b/src/error/option_unwrap/defaults.md @@ -63,17 +63,17 @@ fn main() { To make sure that an `Option` contains a value, we can use `get_or_insert` to modify it in place with a fallback value, as is shown in the following example. Note that `get_or_insert` eagerly evaluates its parameter, so variable `apple` is moved: ```rust,editable -#[derive(Debug)] +#[derive(Debug)] enum Fruit { Apple, Orange, Banana, Kiwi, Lemon } fn main() { let mut my_fruit: Option = None; let apple = Fruit::Apple; let first_available_fruit = my_fruit.get_or_insert(apple); - println!("my_fruit is: {:?}", first_available_fruit); println!("first_available_fruit is: {:?}", first_available_fruit); - // my_fruit is: Apple + println!("my_fruit is: {:?}", my_fruit); // first_available_fruit is: Apple + // my_fruit is: Some(Apple) //println!("Variable named `apple` is moved: {:?}", apple); // TODO: uncomment the line above to see the compiler error }