diff options
| author | bors <bors@rust-lang.org> | 2015-09-18 14:06:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-09-18 14:06:51 +0000 |
| commit | 53ba768b8a88a72cb96e8ff9b76ec36797ba2acd (patch) | |
| tree | 95fb694ccc00a5ce93d343243a3bfb29ef9f357e /src | |
| parent | cff04117064ddee95f425c49f22c8aa5a3a665d4 (diff) | |
| parent | 1a3b422207957c1707980d5624f37f9e9d41ce92 (diff) | |
| download | rust-53ba768b8a88a72cb96e8ff9b76ec36797ba2acd.tar.gz rust-53ba768b8a88a72cb96e8ff9b76ec36797ba2acd.zip | |
Auto merge of #28492 - Ms2ger:a-name, r=steveklabnik
The id attribute has been an official part of HTML since 1997. There is no reason not to use it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/trpl/error-handling.md | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/doc/trpl/error-handling.md b/src/doc/trpl/error-handling.md index 230eb0a85ab..edb794a54ae 100644 --- a/src/doc/trpl/error-handling.md +++ b/src/doc/trpl/error-handling.md @@ -87,7 +87,7 @@ 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"/> +<div id="code-unwrap-double"> ```rust,should_panic use std::env; @@ -99,6 +99,7 @@ fn main() { println!("{}", 2 * n); } ``` +</div> If you give this program zero arguments (error 1) or if the first argument isn't an integer (error 2), the program will panic just like in the first @@ -139,7 +140,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"/> +<div id="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. @@ -152,6 +153,7 @@ fn find(haystack: &str, needle: char) -> Option<usize> { None } ``` +</div> Notice that when this function finds a matching character, it doen't just return the `offset`. Instead, it returns `Some(offset)`. `Some` is a variant or |
