Update error-handling.md
Fix two typos while `io::stdin().read_line()` returns `Result` actually Signed-off-by: acgtyrant <acgtyrant@gmail.com>
This commit is contained in:
parent
3906edf41e
commit
fa3fd813d6
1 changed files with 1 additions and 1 deletions
|
|
@ -214,7 +214,7 @@ we can use the `unwrap()` method:
|
|||
io::stdin().read_line(&mut buffer).unwrap();
|
||||
```
|
||||
|
||||
`unwrap()` will `panic!` if the `Option` is `None`. This basically says "Give
|
||||
`unwrap()` will `panic!` if the `Result` is `Err`. This basically says "Give
|
||||
me the value, and if something goes wrong, just crash." This is less reliable
|
||||
than matching the error and attempting to recover, but is also significantly
|
||||
shorter. Sometimes, just crashing is appropriate.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue