]> git.lizzy.rs Git - rust.git/blobdiff - src/libcore/iter/mod.rs
Change for-loop desugar to not borrow the iterator during the loop
[rust.git] / src / libcore / iter / mod.rs
index 5eefa59e7ea10198f7f9419c39395d0c4058153b..37cc6f98e7306aa7e18ecc774484cbc004d9a5ae 100644 (file)
 //! {
 //!     let result = match IntoIterator::into_iter(values) {
 //!         mut iter => loop {
-//!             match iter.next() {
-//!                 Some(x) => { println!("{}", x); },
+//!             let x = match iter.next() {
+//!                 Some(val) => val,
 //!                 None => break,
-//!             }
+//!             };
+//!             let () = { println!("{}", x); };
 //!         },
 //!     };
 //!     result