about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2015-04-26 10:10:51 -0400
committerCorey Farwell <coreyf@rwell.org>2015-04-26 10:10:51 -0400
commita249910d3417160e2f871bc5a5200bec6b11f518 (patch)
treeb58b2720cd6b121ec6dc71134d6ce4822e27abaa
parent6365080c5cd27b74ec87420c351a3e7bdcff988e (diff)
downloadrust-a249910d3417160e2f871bc5a5200bec6b11f518.tar.gz
rust-a249910d3417160e2f871bc5a5200bec6b11f518.zip
Utilize `while let` instead of `loop` with `break` in doc-comment
-rw-r--r--src/libcollections/vec.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index 526150915a7..c8a8498d2f9 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -116,11 +116,7 @@ static MAX_MEMORY_SIZE: usize = isize::MAX as usize;
 /// stack.push(2);
 /// stack.push(3);
 ///
-/// loop {
-///     let top = match stack.pop() {
-///         None => break, // empty
-///         Some(x) => x,
-///     };
+/// while let Some(top) = stack.pop() {
 ///     // Prints 3, 2, 1
 ///     println!("{}", top);
 /// }