diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 40b3e789ce4..8fdd99e86b0 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -1370,14 +1370,16 @@ impl Receiver { /// let (send, recv) = channel(); /// /// thread::spawn(move || { - /// send.send(1u8).unwrap(); - /// send.send(2u8).unwrap(); - /// send.send(3u8).unwrap(); + /// send.send(1).unwrap(); + /// send.send(2).unwrap(); + /// send.send(3).unwrap(); /// }); /// - /// for x in recv.iter() { - /// println!("Got: {}", x); - /// } + /// let mut iter = recv.iter(); + /// assert_eq!(iter.next(), Some(1)); + /// assert_eq!(iter.next(), Some(2)); + /// assert_eq!(iter.next(), Some(3)); + /// assert_eq!(iter.next(), None); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn iter(&self) -> Iter {