trivial fixes to documentation (book)

This commit is contained in:
bnewbold 2016-05-11 11:53:07 -04:00
parent c049541741
commit 8e8f3911aa
3 changed files with 5 additions and 5 deletions

View File

@ -115,7 +115,7 @@ $ ls target/debug
build deps examples libphrases-a7448e02a0468eaa.rlib native
```
`libphrases-hash.rlib` is the compiled crate. Before we see how to use this
`libphrases-<hash>.rlib` is the compiled crate. Before we see how to use this
crate from another crate, lets break it up into multiple files.
# Multiple File Crates

View File

@ -225,7 +225,7 @@ sense to put it into a function:
```rust
# fn find(_: &str, _: char) -> Option<usize> { None }
// Returns the extension of the given file name, where the extension is defined
// as all characters proceeding the first `.`.
// as all characters following the first `.`.
// If `file_name` has no `.`, then `None` is returned.
fn extension_explicit(file_name: &str) -> Option<&str> {
match find(file_name, '.') {
@ -274,7 +274,7 @@ to get rid of the case analysis:
```rust
# fn find(_: &str, _: char) -> Option<usize> { None }
// Returns the extension of the given file name, where the extension is defined
// as all characters proceeding the first `.`.
// as all characters following the first `.`.
// If `file_name` has no `.`, then `None` is returned.
fn extension(file_name: &str) -> Option<&str> {
find(file_name, '.').map(|i| &file_name[i+1..])

View File

@ -84,8 +84,8 @@ fn it_works() {
```
`assert!` is a macro provided by Rust which takes one argument: if the argument
is `true`, nothing happens. If the argument is `false`, it `panic!`s. Let's run
our tests again:
is `true`, nothing happens. If the argument is `false`, it will `panic!`. Let's
run our tests again:
```bash
$ cargo test