From 729060dbb95afd1d8562a6b3129555a173b81b0c Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Thu, 30 Jan 2014 11:20:34 +1100 Subject: Remove Times trait `Times::times` was always a second-class loop because it did not support the `break` and `continue` operations. Its playful appeal was then lost after `do` was disabled for closures. It's time to let this one go. --- src/libsyntax/diagnostic.rs | 7 ++++--- src/libsyntax/ext/tt/macro_parser.rs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index a9d3f6fea24..fabc244e00a 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -14,6 +14,7 @@ use codemap; use std::cell::Cell; use std::io; use std::io::stdio::StdWriter; +use std::iter::range; use std::local_data; use extra::term; @@ -320,7 +321,7 @@ fn highlight_lines(cm: &codemap::CodeMap, // 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 + 3u; - skip.times(|| s.push_char(' ')); + for _ in range(0, skip) { s.push_char(' '); } let orig = fm.get_line(lines.lines[0] as int); for pos in range(0u, left-skip) { let curChar = (orig[pos] as char); @@ -339,7 +340,7 @@ fn highlight_lines(cm: &codemap::CodeMap, if hi.col != lo.col { // the ^ already takes up one space let num_squigglies = hi.col.to_uint()-lo.col.to_uint()-1u; - num_squigglies.times(|| s.push_char('~')); + for _ in range(0, num_squigglies) { s.push_char('~'); } } print_maybe_styled(s + "\n", term::attr::ForegroundColor(lvl.color())); } @@ -378,7 +379,7 @@ fn custom_highlight_lines(cm: &codemap::CodeMap, // Span seems to use half-opened interval, so subtract 1 let skip = last_line_start.len() + hi.col.to_uint() - 1; let mut s = ~""; - skip.times(|| s.push_char(' ')); + for _ in range(0, skip) { s.push_char(' '); } s.push_char('^'); print_maybe_styled(s + "\n", term::attr::ForegroundColor(lvl.color())); } diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 492852c6a79..d5a30a7cf11 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -396,9 +396,9 @@ pub fn parse(sess: @ParseSess, } cur_eis.push(ei); - rust_parser.tokens_consumed.times(|| { + for _ in range(0, rust_parser.tokens_consumed) { let _ = rdr.next_token(); - }); + } } } -- cgit 1.4.1-3-g733a5