about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-04-19 18:04:41 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-04-19 18:14:38 -0700
commitcdc8722f9503efdac0c619cfed1958192fe59eb9 (patch)
treea503c1669e4fb8f7191d1245eaf610f9b38b721a /src/libcore
parent594d22e7e24a630957aefa29f9da9a92e3c31587 (diff)
downloadrust-cdc8722f9503efdac0c619cfed1958192fe59eb9.tar.gz
rust-cdc8722f9503efdac0c619cfed1958192fe59eb9.zip
Add a lint pass to check for while true { ... } loops
And suggest changing them to loop { ... }. Had to fix the few
remaining while true loops (in core::io). Closes #1962.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/io.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcore/io.rs b/src/libcore/io.rs
index 01edaeabe05..b44ec02c74b 100644
--- a/src/libcore/io.rs
+++ b/src/libcore/io.rs
@@ -110,7 +110,7 @@ impl reader_util for reader {
 
     fn read_line() -> str {
         let mut buf: [u8] = [];
-        while true {
+        loop {
             let ch = self.read_byte();
             if ch == -1 || ch == 10 { break; }
             buf += [ch as u8];
@@ -120,7 +120,7 @@ impl reader_util for reader {
 
     fn read_c_str() -> str {
         let mut buf: [u8] = [];
-        while true {
+        loop {
             let ch = self.read_byte();
             if ch < 1 { break; } else { buf += [ch as u8]; }
         }