@@ -225,7 +225,7 @@ sense to put it into a function:
225
225
``` rust
226
226
# fn find (_ : & str , _ : char ) -> Option <usize > { None }
227
227
// 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 `.`.
229
229
// If `file_name` has no `.`, then `None` is returned.
230
230
fn extension_explicit (file_name : & str ) -> Option <& str > {
231
231
match find (file_name , '.' ) {
@@ -272,7 +272,7 @@ to get rid of the case analysis:
272
272
``` rust
273
273
# fn find (_ : & str , _ : char ) -> Option <usize > { None }
274
274
// 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 `.`.
276
276
// If `file_name` has no `.`, then `None` is returned.
277
277
fn extension (file_name : & str ) -> Option <& str > {
278
278
find (file_name , '.' ). map (| i | & file_name [i + 1 .. ])
@@ -755,7 +755,7 @@ fn main() {
755
755
(N.B. The ` AsRef<Path> ` is used because those are the
756
756
[ same bounds used on
757
757
` 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.)
759
759
760
760
There are three different errors that can occur here:
761
761
@@ -1284,7 +1284,7 @@ fn file_double<P: AsRef<Path>>(file_path: P) -> Result<i32, String> {
1284
1284
1285
1285
Earlier, we promised that we could get rid of the ` map_err ` calls. Indeed, all
1286
1286
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
1288
1288
` Box<Error> ` :
1289
1289
1290
1290
``` rust
@@ -1552,7 +1552,7 @@ parser and a help message from a vector of options (The fact that it
1552
1552
is a vector is hidden behind a struct and a set of methods). Once the
1553
1553
parsing is done, we can decode the program arguments into a Rust
1554
1554
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
1556
1556
had. Here's our program with the appropriate ` extern crate `
1557
1557
statements, and the basic argument setup for Getopts:
1558
1558
@@ -1594,7 +1594,7 @@ then store the first one, knowing that it is our program's name. Once
1594
1594
that's done, we set up our argument flags, in this case a simplistic
1595
1595
help message flag. Once we have the argument flags set up, we use
1596
1596
` 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
1598
1598
assign matches to the parsed object, if not, we panic. Once past that,
1599
1599
we test if the user passed in the help flag, and if so print the usage
1600
1600
message. The option help messages are constructed by Getopts, so all
@@ -1896,7 +1896,7 @@ for pop in search(&data_file, &city) {
1896
1896
...
1897
1897
```
1898
1898
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
1900
1900
` Option<String> ` ), and convert it to a type that ` search ` can use, in
1901
1901
this case, ` &Option<AsRef<Path>> ` . Do do this, we take a reference of
1902
1902
file, and map ` Path::new ` onto it. In this case, ` as_ref() ` converts
@@ -2120,7 +2120,7 @@ heuristics!
2120
2120
and
2121
2121
[ ` Error ` ] ( ../std/error/trait.Error.html )
2122
2122
impls to make the [ ` try! ` ] ( ../std/macro.try!.html )
2123
- macro more ergnomic .
2123
+ macro more ergonomic .
2124
2124
* If you're writing a library and your code can produce errors, define your own
2125
2125
error type and implement the
2126
2126
[ ` std::error::Error ` ] ( ../std/error/trait.Error.html )
0 commit comments