diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-26 15:46:12 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-29 07:47:37 -0500 |
| commit | 7d661af9c86566088f7dbaeee25143ecde673b75 (patch) | |
| tree | 54aa9b410d06064bdc893f034e1b86921698aea9 /src/libsyntax | |
| parent | c300d681bd2e901ef39591bbfb1ea4568ac6be70 (diff) | |
| download | rust-7d661af9c86566088f7dbaeee25143ecde673b75.tar.gz rust-7d661af9c86566088f7dbaeee25143ecde673b75.zip | |
`for x in range(a, b)` -> `for x in a..b`
sed -i 's/in range(\([^,]*\), *\([^()]*\))/in \1\.\.\2/g' **/*.rs
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/codemap.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 2 |
6 files changed, 15 insertions, 15 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index e0d4f69a34c..f93a8b4b317 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -431,7 +431,7 @@ impl CodeMap { let lo = self.lookup_char_pos(sp.lo); let hi = self.lookup_char_pos(sp.hi); let mut lines = Vec::new(); - for i in range(lo.line - 1us, hi.line as usize) { + for i in lo.line - 1us..hi.line as usize { lines.push(i); }; FileLines {file: lo.file, lines: lines} diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index f3e66897316..4ffa0551881 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -490,11 +490,11 @@ fn highlight_lines(err: &mut EmitterWriter, // Skip is the number of characters we need to skip because they are // part of the 'filename:line ' part of the previous line. let skip = fm.name.len() + digits + 3us; - for _ in range(0, skip) { + for _ in 0..skip { s.push(' '); } if let Some(orig) = fm.get_line(lines.lines[0]) { - for pos in range(0us, left - skip) { + for pos in 0us..left - skip { let cur_char = orig.as_bytes()[pos] as char; // Whenever a tab occurs on the previous line, we insert one on // the error-point-squiggly-line as well (instead of a space). @@ -513,7 +513,7 @@ fn highlight_lines(err: &mut EmitterWriter, if hi.col != lo.col { // the ^ already takes up one space let num_squigglies = hi.col.to_usize() - lo.col.to_usize() - 1us; - for _ in range(0, num_squigglies) { + for _ in 0..num_squigglies { s.push('~'); } } @@ -563,7 +563,7 @@ fn custom_highlight_lines(w: &mut EmitterWriter, // Span seems to use half-opened interval, so subtract 1 let skip = last_line_start.len() + hi.col.to_usize() - 1; let mut s = String::new(); - for _ in range(0, skip) { + for _ in 0..skip { s.push(' '); } s.push('^'); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 993d9000ae1..a718cc597c4 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -339,7 +339,7 @@ pub fn parse(sess: &ParseSess, // most of the time. // Only touch the binders we have actually bound - for idx in range(ei.match_lo, ei.match_hi) { + for idx in ei.match_lo..ei.match_hi { let sub = (ei.matches[idx]).clone(); (&mut new_pos.matches[idx]) .push(Rc::new(MatchedSeq(sub, mk_sp(ei.sp_lo, @@ -385,7 +385,7 @@ pub fn parse(sess: &ParseSess, new_ei.match_cur += seq.num_captures; new_ei.idx += 1us; //we specifically matched zero repeats. - for idx in range(ei.match_cur, ei.match_cur + seq.num_captures) { + for idx in ei.match_cur..ei.match_cur + seq.num_captures { (&mut new_ei.matches[idx]).push(Rc::new(MatchedSeq(vec![], sp))); } @@ -495,7 +495,7 @@ pub fn parse(sess: &ParseSess, } cur_eis.push(ei); - for _ in range(0, rust_parser.tokens_consumed) { + for _ in 0..rust_parser.tokens_consumed { let _ = rdr.next_token(); } } diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 99be1b11b11..417e440844a 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -732,7 +732,7 @@ impl<'a> StringReader<'a> { let start_bpos = self.last_pos; let mut accum_int = 0; - for _ in range(0, n_digits) { + for _ in 0..n_digits { if self.is_eof() { let last_bpos = self.last_pos; self.fatal_span_(start_bpos, last_bpos, "unterminated numeric character escape"); @@ -1217,7 +1217,7 @@ impl<'a> StringReader<'a> { } //if self.curr_is('"') { //content_end_bpos = self.last_pos; - //for _ in range(0, hash_count) { + //for _ in 0..hash_count { //self.bump(); //if !self.curr_is('#') { //continue 'outer; @@ -1225,7 +1225,7 @@ impl<'a> StringReader<'a> { match c { '"' => { content_end_bpos = self.last_pos; - for _ in range(0, hash_count) { + for _ in 0..hash_count { self.bump(); if !self.curr_is('#') { continue 'outer; @@ -1402,7 +1402,7 @@ impl<'a> StringReader<'a> { }, Some('"') => { content_end_bpos = self.last_pos; - for _ in range(0, hash_count) { + for _ in 0..hash_count { self.bump(); if !self.curr_is('#') { continue 'outer; diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 4bd476885a0..7834fae6276 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -472,7 +472,7 @@ pub fn str_lit(lit: &str) -> String { } else { // otherwise, a normal escape let (c, n) = char_lit(&lit[i..]); - for _ in range(0, n - 1) { // we don't need to move past the first \ + for _ in 0..n - 1 { // we don't need to move past the first \ chars.next(); } res.push(c); @@ -635,7 +635,7 @@ pub fn binary_lit(lit: &str) -> Rc<Vec<u8>> { // otherwise, a normal escape let (c, n) = byte_lit(&lit[i..]); // we don't need to move past the first \ - for _ in range(0, n - 1) { + for _ in 0..n - 1 { chars.next(); } res.push(c); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index ae3c4addf38..fe46830c50d 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2457,7 +2457,7 @@ impl<'a> State<'a> { try!(word(&mut self.s, "<")); let mut ints = Vec::new(); - for i in range(0us, total) { + for i in 0us..total { ints.push(i); } |
