Whitespace in code

This commit is contained in:
Carol (Nichols || Goulding) 2016-10-18 18:30:35 -04:00
parent 0cd5b91fec
commit ee823778b1
2 changed files with 6 additions and 0 deletions

View File

@ -187,6 +187,7 @@ call `unwrap`. Here's an example:
```rust ```rust
use std::net::IpAddr; use std::net::IpAddr;
let home = "127.0.0.1".parse::<IpAddr>().unwrap(); let home = "127.0.0.1".parse::<IpAddr>().unwrap();
``` ```
@ -256,7 +257,9 @@ expressions:
fn read_username_from_file() -> Result<String, io::Error> { fn read_username_from_file() -> Result<String, io::Error> {
let mut f = try!(File::open("hello.txt")); let mut f = try!(File::open("hello.txt"));
let mut s = String::new(); let mut s = String::new();
try!(f.read_to_string(&mut s)); try!(f.read_to_string(&mut s));
Ok(s) Ok(s)
} }
``` ```
@ -316,7 +319,9 @@ by instead doing:
# #
fn read_username_from_file() -> Result<String, io::Error> { fn read_username_from_file() -> Result<String, io::Error> {
let mut s = String::new(); let mut s = String::new();
File::open("hello.txt")?.read_to_string(&mut s)?; File::open("hello.txt")?.read_to_string(&mut s)?;
Ok(s) Ok(s)
} }
``` ```

View File

@ -120,6 +120,7 @@ impl Guess {
if value < 1 || value > 100 { if value < 1 || value > 100 {
panic!("Guess value must be between 1 and 100, got {}.", value); panic!("Guess value must be between 1 and 100, got {}.", value);
} }
Guess { Guess {
value: value, value: value,
} }