Fixing more spelling mistakes!!!!!

This commit is contained in:
Carol (Nichols || Goulding)
2016-12-28 19:48:06 -05:00
parent 70efcbe967
commit de6075be98
5 changed files with 16 additions and 13 deletions
+3
View File
@@ -141,6 +141,7 @@ namespace
namespaced
namespaces
namespacing
newfound
nocapture
nomicon
Nomicon
@@ -193,6 +194,7 @@ someusername
SpreadsheetCell
sqrt
stackoverflow
stderr
stdin
Stdin
stdlib
@@ -241,5 +243,6 @@ workspace
workspaces
Workspaces
wouldn
writeln
WriteMessage
yyyy
@@ -90,8 +90,8 @@ this change, run the program again to verify that the argument parsing still
works. It's good to check your progress often, so that you have a better idea
of which change caused a problem, should you encounter one.
<!-- steve: cargo check is going to be in stable rust soon, so we should
include it here i think. Thoughts? -->
<!-- `cargo check` is going to be in stable rust soon, so we should
include it here i think. Thoughts? /Steve -->
<!-- I haven't been keeping up with what cargo check does-- it just checks
syntax? If it seems worthwhile to check that but not the functionality, I'd
be into it! /Carol -->
@@ -106,12 +106,12 @@ function `parse_config`. The `config` part of the name is saying the two values
we return should really be bound together, since they're both part of one
configuration value.
> Note: some people call this antipattern of using primitive values when a
> Note: some people call this anti-pattern of using primitive values when a
> complex type would be more appropriate *primitive obsession*.
Let's introduce a struct to hold all of our configuration. Listing 12-5 shows
the addition of the `Config` struct definition, the refacting of `parse_config`,
and updates to `main`:
the addition of the `Config` struct definition, the refactoring of
`parse_config`, and updates to `main`:
<figure>
<span class="filename">Filename: src/main.rs</span>
@@ -159,7 +159,7 @@ struct
The signature of `parse_config` now indicates that it returns a `Config` value.
In the body of `parse_config`, we used to be returning string slices that were
references to `String` values in `args`, but we've defined `Config` to contain
owend `String` values. Because the argument to `parse_config` is a slice of
owned `String` values. Because the argument to `parse_config` is a slice of
`String` values, the `Config` instance can't take ownership of the `String`
values: that violates Rust's borrowing rules, since the `args` variable in
`main` owns the `String` values and is only letting the `parse_config` function
@@ -609,7 +609,7 @@ method, and on the `run` function.
Now in *src/main.rs*, we need to bring in the code that's now in *src/lib.rs*
through `extern crate greprs`. Then we need to add a `use greprs::Config` line
to bring `Corfig` into scope, and prefix the `run` function with our crate name
to bring `Config` into scope, and prefix the `run` function with our crate name
as shown in Listing 12-13:
<figure>
@@ -9,7 +9,7 @@ arguments and check return values without having to call our binary from the
command line.
We're going to write a function named `grep` that takes our search term and the
text to search and procudes a list of search results. Let's remove that
text to search and produces a list of search results. Let's remove that
`println!` from `run` (and from *src/main.rs* as well, as we don't really need
those anymore either), and call the new `grep` function with the options we've
collected. We'll add a placeholder implementation of the function for now, and
@@ -107,7 +107,7 @@ we want to return the parts of that text that match, we know `contents` is the
argument that should be connected to the return value using the lifetime syntax.
Connecting arguments to return values in the signature is something that other
programming langugages don't make you do, so don't worry if this still feels
programming languages don't make you do, so don't worry if this still feels
strange! Knowing how to specify lifetimes gets easier over time, and practice
makes perfect. You may want to re-read the above section or go back and compare
this example with the Lifetime Syntax section in Chapter 10.
@@ -118,7 +118,7 @@ Now let's try running our test:
$ cargo test
...warnings...
Finished debug [unoptimized + debuginfo] target(s) in 0.43 secs
Running target/debug/deps/greprs-917c5edfc3cf199a
Running target/debug/deps/greprs-abcabcabc
running 1 test
test test::one_result ... FAILED
@@ -262,7 +262,7 @@ Now our whole program should be working! Let's try it out:
```text
$ cargo run the poem.txt
Compiling greprs v0.1.0 (file:///C:/Users/steve/tmp/greprs)
Compiling greprs v0.1.0 (file:///projects/greprs)
Finished debug [unoptimized + debuginfo] target(s) in 0.38 secs
Running `target\debug\greprs.exe the poem.txt`
Then there's a pair of us - don't tell!
@@ -1,7 +1,7 @@
## Working with Environment Variables
Let's add one more feature: case insensitive searching. In addtion, this
Let's add one more feature: case insensitive searching. In addition, this
setting won't be a command line option: it'll be an environment variable
instead. We could choose to make case insensitivity a command line option, but
our users have requested an environment variable that they could set once and
@@ -72,7 +72,7 @@ Listing 12-15: Writing error messages to `stderr` instead of `stdout`
Rust does not have a convenient function like `println!` for writing to
standard error. Instead, we use the `writeln!` macro, which is sort of like
`println!`, but it takes an extra argument. The first thing we pass to it is
what to write to. We can aquire a handle to standard error through the
what to write to. We can acquire a handle to standard error through the
`std::io::stderr` function. We give a mutable reference to `stderr` to
`writeln!`; we need it to be mutable so we can write to it! The second and
third arguments to `writeln!` are like the first and second arguments to