Skip to content

Commit 5ff4442

Browse files
committed
Auto merge of #28831 - Seeker14491:patch-1, r=steveklabnik
2 parents 1dcbd35 + a0284f4 commit 5ff4442

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/doc/trpl/error-handling.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ sense to put it into a function:
225225
```rust
226226
# fn find(_: &str, _: char) -> Option<usize> { None }
227227
// Returns the extension of the given file name, where the extension is defined
228-
// as all characters proceding the first `.`.
228+
// as all characters proceeding the first `.`.
229229
// If `file_name` has no `.`, then `None` is returned.
230230
fn extension_explicit(file_name: &str) -> Option<&str> {
231231
match find(file_name, '.') {
@@ -272,7 +272,7 @@ to get rid of the case analysis:
272272
```rust
273273
# fn find(_: &str, _: char) -> Option<usize> { None }
274274
// Returns the extension of the given file name, where the extension is defined
275-
// as all characters proceding the first `.`.
275+
// as all characters proceeding the first `.`.
276276
// If `file_name` has no `.`, then `None` is returned.
277277
fn extension(file_name: &str) -> Option<&str> {
278278
find(file_name, '.').map(|i| &file_name[i+1..])
@@ -755,7 +755,7 @@ fn main() {
755755
(N.B. The `AsRef<Path>` is used because those are the
756756
[same bounds used on
757757
`std::fs::File::open`](../std/fs/struct.File.html#method.open).
758-
This makes it ergnomic to use any kind of string as a file path.)
758+
This makes it ergonomic to use any kind of string as a file path.)
759759

760760
There are three different errors that can occur here:
761761

@@ -1284,7 +1284,7 @@ fn file_double<P: AsRef<Path>>(file_path: P) -> Result<i32, String> {
12841284

12851285
Earlier, we promised that we could get rid of the `map_err` calls. Indeed, all
12861286
we have to do is pick a type that `From` works with. As we saw in the previous
1287-
section, `From` has an impl that let's it convert any error type into a
1287+
section, `From` has an impl that lets it convert any error type into a
12881288
`Box<Error>`:
12891289

12901290
```rust
@@ -1552,7 +1552,7 @@ parser and a help message from a vector of options (The fact that it
15521552
is a vector is hidden behind a struct and a set of methods). Once the
15531553
parsing is done, we can decode the program arguments into a Rust
15541554
struct. From there, we can get information about the flags, for
1555-
instance, wether they were passed in, and what arguments they
1555+
instance, whether they were passed in, and what arguments they
15561556
had. Here's our program with the appropriate `extern crate`
15571557
statements, and the basic argument setup for Getopts:
15581558

@@ -1594,7 +1594,7 @@ then store the first one, knowing that it is our program's name. Once
15941594
that's done, we set up our argument flags, in this case a simplistic
15951595
help message flag. Once we have the argument flags set up, we use
15961596
`Options.parse` to parse the argument vector (starting from index one,
1597-
becouse index 0 is the program name). If this was successful, we
1597+
because index 0 is the program name). If this was successful, we
15981598
assign matches to the parsed object, if not, we panic. Once past that,
15991599
we test if the user passed in the help flag, and if so print the usage
16001600
message. The option help messages are constructed by Getopts, so all
@@ -1896,7 +1896,7 @@ for pop in search(&data_file, &city) {
18961896
...
18971897
```
18981898

1899-
In this peice of code, we take `file` (which has the type
1899+
In this piece of code, we take `file` (which has the type
19001900
`Option<String>`), and convert it to a type that `search` can use, in
19011901
this case, `&Option<AsRef<Path>>`. Do do this, we take a reference of
19021902
file, and map `Path::new` onto it. In this case, `as_ref()` converts
@@ -2120,7 +2120,7 @@ heuristics!
21202120
and
21212121
[`Error`](../std/error/trait.Error.html)
21222122
impls to make the [`try!`](../std/macro.try!.html)
2123-
macro more ergnomic.
2123+
macro more ergonomic.
21242124
* If you're writing a library and your code can produce errors, define your own
21252125
error type and implement the
21262126
[`std::error::Error`](../std/error/trait.Error.html)

0 commit comments

Comments
 (0)