Skip to content

Commit

Permalink
Rollup merge of rust-lang#28422 - christopherdumas:label_code, r=stev…
Browse files Browse the repository at this point in the history
…eklabnik
  • Loading branch information
steveklabnik committed Sep 15, 2015
2 parents fe8a95e + b69a511 commit d895106
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/doc/trpl/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ thread '<main>' panicked at 'Invalid number: 11', src/bin/panic-simple.rs:5
Here's another example that is slightly less contrived. A program that accepts
an integer as an argument, doubles it and prints it.

<a name="code-unwrap-double"/>
```rust,should_panic
use std::env;
fn main() {
Expand Down Expand Up @@ -120,7 +122,7 @@ It would be better if we just showed the code for unwrapping because it is so
simple, but to do that, we will first need to explore the `Option` and `Result`
types. Both of these types have a method called `unwrap` defined on them.

## The `Option` type
### The `Option` type

The `Option` type is [defined in the standard library][5]:

Expand All @@ -137,6 +139,7 @@ system is an important concept because it will cause the compiler to force the
programmer to handle that absence. Let's take a look at an example that tries
to find a character in a string:

<a name="code-option-ex-string-find"/>
```rust
// Searches `haystack` for the Unicode character `needle`. If one is found, the
// byte offset of the character is returned. Otherwise, `None` is returned.
Expand Down

0 comments on commit d895106

Please sign in to comment.