diff --git a/src/doc/book/if-let.md b/src/doc/book/if-let.md index faa922acb3de2..9afe5fa826d29 100644 --- a/src/doc/book/if-let.md +++ b/src/doc/book/if-let.md @@ -58,13 +58,13 @@ if let Some(x) = option { ## `while let` In a similar fashion, `while let` can be used when you want to conditionally -loop as long as a value matches a certain pattern. It turns code like this: +loop as long as a value matches a certain pattern. It turns code like this: ```rust -# let option: Option = None; +let mut v = vec![1, 3, 5, 7, 11]; loop { - match option { - Some(x) => println!("{}", x), + match v.pop() { + Some(x) => println!("{}", x), None => break, } } @@ -73,8 +73,8 @@ loop { Into code like this: ```rust -# let option: Option = None; -while let Some(x) = option { +let mut v = vec![1, 3, 5, 7, 11]; +while let Some(x) = v.pop() { println!("{}", x); } ``` diff --git a/src/libstd/env.rs b/src/libstd/env.rs index b81b2a71ad654..a63c90c4a91d1 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -326,7 +326,7 @@ fn _remove_var(k: &OsStr) { }) } -/// An iterator over `Path` instances for parsing an environment variable +/// An iterator over `PathBuf` instances for parsing an environment variable /// according to platform-specific conventions. /// /// This structure is returned from `std::env::split_paths`.