diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 268a6020a10a5..b48ccfc43742d 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -1512,7 +1512,7 @@ fn _arm_exec_compiled_test(config: &Config, for c in exitcode_out.as_slice().chars() { if !c.is_digit() { break; } exitcode = exitcode * 10 + match c { - '0' .. '9' => c as int - ('0' as int), + '0' ... '9' => c as int - ('0' as int), _ => 101, } } diff --git a/src/doc/guide.md b/src/doc/guide.md index 0474e5a31ce1d..074dfc17b0d78 100644 --- a/src/doc/guide.md +++ b/src/doc/guide.md @@ -3757,27 +3757,27 @@ match x { } ``` -You can match a range of values with `..`: +You can match a range of values with `...`: ```{rust} let x = 1i; match x { - 1 .. 5 => println!("one through five"), + 1 ... 5 => println!("one through five"), _ => println!("anything"), } ``` Ranges are mostly used with integers and single characters. -If you're matching multiple things, via a `|` or a `..`, you can bind +If you're matching multiple things, via a `|` or a `...`, you can bind the value to a name with `@`: ```{rust} let x = 1i; match x { - x @ 1 .. 5 => println!("got {}", x), + x @ 1 ... 5 => println!("got {}", x), _ => println!("anything"), } ``` diff --git a/src/doc/reference.md b/src/doc/reference.md index 21da810a30098..8fa282c2a39eb 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -3408,7 +3408,7 @@ may be specified with `..`. For example: let message = match x { 0 | 1 => "not many", - 2 .. 9 => "a few", + 2 ... 9 => "a few", _ => "lots" }; ``` diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index a856642c9361b..d6adbd302645a 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -199,10 +199,10 @@ impl String { } 3 => { match (byte, safe_get(v, i, total)) { - (0xE0 , 0xA0 .. 0xBF) => (), - (0xE1 .. 0xEC, 0x80 .. 0xBF) => (), - (0xED , 0x80 .. 0x9F) => (), - (0xEE .. 0xEF, 0x80 .. 0xBF) => (), + (0xE0 , 0xA0 ... 0xBF) => (), + (0xE1 ... 0xEC, 0x80 ... 0xBF) => (), + (0xED , 0x80 ... 0x9F) => (), + (0xEE ... 0xEF, 0x80 ... 0xBF) => (), _ => { error!(); continue; @@ -217,9 +217,9 @@ impl String { } 4 => { match (byte, safe_get(v, i, total)) { - (0xF0 , 0x90 .. 0xBF) => (), - (0xF1 .. 0xF3, 0x80 .. 0xBF) => (), - (0xF4 , 0x80 .. 0x8F) => (), + (0xF0 , 0x90 ... 0xBF) => (), + (0xF1 ... 0xF3, 0x80 ... 0xBF) => (), + (0xF4 , 0x80 ... 0x8F) => (), _ => { error!(); continue; diff --git a/src/libcore/char.rs b/src/libcore/char.rs index c870f1b8f70a1..1e87d11d37367 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -123,9 +123,9 @@ pub fn to_digit(c: char, radix: uint) -> Option { fail!("to_digit: radix is too high (maximum 36)"); } let val = match c { - '0' .. '9' => c as uint - ('0' as uint), - 'a' .. 'z' => c as uint + 10u - ('a' as uint), - 'A' .. 'Z' => c as uint + 10u - ('A' as uint), + '0' ... '9' => c as uint - ('0' as uint), + 'a' ... 'z' => c as uint + 10u - ('a' as uint), + 'A' ... 'Z' => c as uint + 10u - ('A' as uint), _ => return None, }; if val < radix { Some(val) } @@ -184,7 +184,7 @@ pub fn escape_unicode(c: char, f: |char|) { let offset = offset as uint; unsafe { match ((c as i32) >> offset) & 0xf { - i @ 0 .. 9 => { f(transmute('0' as i32 + i)); } + i @ 0 ... 9 => { f(transmute('0' as i32 + i)); } i => { f(transmute('a' as i32 + (i - 10))); } } } @@ -211,7 +211,7 @@ pub fn escape_default(c: char, f: |char|) { '\\' => { f('\\'); f('\\'); } '\'' => { f('\\'); f('\''); } '"' => { f('\\'); f('"'); } - '\x20' .. '\x7e' => { f(c); } + '\x20' ... '\x7e' => { f(c); } _ => c.escape_unicode(f), } } diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index eb8d684fe50fd..afcd0d1d645e6 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -99,13 +99,13 @@ macro_rules! radix { } } -radix!(Binary, 2, "0b", x @ 0 .. 2 => b'0' + x) -radix!(Octal, 8, "0o", x @ 0 .. 7 => b'0' + x) -radix!(Decimal, 10, "", x @ 0 .. 9 => b'0' + x) -radix!(LowerHex, 16, "0x", x @ 0 .. 9 => b'0' + x, - x @ 10 ..15 => b'a' + (x - 10)) -radix!(UpperHex, 16, "0x", x @ 0 .. 9 => b'0' + x, - x @ 10 ..15 => b'A' + (x - 10)) +radix!(Binary, 2, "0b", x @ 0 ... 2 => b'0' + x) +radix!(Octal, 8, "0o", x @ 0 ... 7 => b'0' + x) +radix!(Decimal, 10, "", x @ 0 ... 9 => b'0' + x) +radix!(LowerHex, 16, "0x", x @ 0 ... 9 => b'0' + x, + x @ 10 ... 15 => b'a' + (x - 10)) +radix!(UpperHex, 16, "0x", x @ 0 ... 9 => b'0' + x, + x @ 10 ... 15 => b'A' + (x - 10)) /// A radix with in the range of `2..36`. #[deriving(Clone, PartialEq)] @@ -124,7 +124,7 @@ impl GenericRadix for Radix { fn base(&self) -> u8 { self.base } fn digit(&self, x: u8) -> u8 { match x { - x @ 0 ..9 => b'0' + x, + x @ 0 ... 9 => b'0' + x, x if x < self.base() => b'a' + (x - 10), x => fail!("number not in the range 0..{}: {}", self.base() - 1, x), } diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 343b8e0b64b0f..fd7c63a6b3262 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -843,18 +843,18 @@ fn run_utf8_validation_iterator(iter: &mut slice::Items) -> bool { 2 => if second & !CONT_MASK != TAG_CONT_U8 {err!()}, 3 => { match (first, second, next!() & !CONT_MASK) { - (0xE0 , 0xA0 .. 0xBF, TAG_CONT_U8) | - (0xE1 .. 0xEC, 0x80 .. 0xBF, TAG_CONT_U8) | - (0xED , 0x80 .. 0x9F, TAG_CONT_U8) | - (0xEE .. 0xEF, 0x80 .. 0xBF, TAG_CONT_U8) => {} + (0xE0 , 0xA0 ... 0xBF, TAG_CONT_U8) | + (0xE1 ... 0xEC, 0x80 ... 0xBF, TAG_CONT_U8) | + (0xED , 0x80 ... 0x9F, TAG_CONT_U8) | + (0xEE ... 0xEF, 0x80 ... 0xBF, TAG_CONT_U8) => {} _ => err!() } } 4 => { match (first, second, next!() & !CONT_MASK, next!() & !CONT_MASK) { - (0xF0 , 0x90 .. 0xBF, TAG_CONT_U8, TAG_CONT_U8) | - (0xF1 .. 0xF3, 0x80 .. 0xBF, TAG_CONT_U8, TAG_CONT_U8) | - (0xF4 , 0x80 .. 0x8F, TAG_CONT_U8, TAG_CONT_U8) => {} + (0xF0 , 0x90 ... 0xBF, TAG_CONT_U8, TAG_CONT_U8) | + (0xF1 ... 0xF3, 0x80 ... 0xBF, TAG_CONT_U8, TAG_CONT_U8) | + (0xF4 , 0x80 ... 0x8F, TAG_CONT_U8, TAG_CONT_U8) => {} _ => err!() } } diff --git a/src/libdebug/repr.rs b/src/libdebug/repr.rs index 64dc87908824b..5fbba286feadf 100644 --- a/src/libdebug/repr.rs +++ b/src/libdebug/repr.rs @@ -227,7 +227,7 @@ impl<'a> ReprVisitor<'a> { self.writer.write("\"".as_bytes()) } } - '\x20'..'\x7e' => self.writer.write([ch as u8]), + '\x20'...'\x7e' => self.writer.write([ch as u8]), _ => { char::escape_unicode(ch, |c| { let _ = self.writer.write([c as u8]); diff --git a/src/libnative/io/tty_windows.rs b/src/libnative/io/tty_windows.rs index 7263036e1659e..1c3904a89433e 100644 --- a/src/libnative/io/tty_windows.rs +++ b/src/libnative/io/tty_windows.rs @@ -67,7 +67,7 @@ impl WindowsTTY { // If the file descriptor is one of stdin, stderr, or stdout // then it should not be closed by us let closeme = match fd { - 0..2 => false, + 0...2 => false, _ => true, }; let handle = unsafe { get_osfhandle(fd) as HANDLE }; diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs index 7b6e94eaa9209..8ae7f070ddb25 100644 --- a/src/librand/distributions/gamma.rs +++ b/src/librand/distributions/gamma.rs @@ -98,9 +98,9 @@ impl Gamma { assert!(scale > 0.0, "Gamma::new called with scale <= 0"); let repr = match shape { - 1.0 => One(Exp::new(1.0 / scale)), - 0.0 .. 1.0 => Small(GammaSmallShape::new_raw(shape, scale)), - _ => Large(GammaLargeShape::new_raw(shape, scale)) + 1.0 => One(Exp::new(1.0 / scale)), + 0.0 ... 1.0 => Small(GammaSmallShape::new_raw(shape, scale)), + _ => Large(GammaLargeShape::new_raw(shape, scale)) }; Gamma { repr: repr } } diff --git a/src/libregex/vm.rs b/src/libregex/vm.rs index 6db07923c4d57..085975580b757 100644 --- a/src/libregex/vm.rs +++ b/src/libregex/vm.rs @@ -512,7 +512,7 @@ pub fn is_word(c: Option) -> bool { }; // Try the common ASCII case before invoking binary search. match c { - '_' | '0' .. '9' | 'a' .. 'z' | 'A' .. 'Z' => true, + '_' | '0' ... '9' | 'a' ... 'z' | 'A' ... 'Z' => true, _ => PERLW.binary_search(|&(start, end)| { if c >= start && c <= end { Equal diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index b793096b30a4f..0708fdc6eba1e 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -277,9 +277,9 @@ pub fn sanitize(s: &str) -> String { '-' | ':' => result.push_char('.'), // These are legal symbols - 'a' .. 'z' - | 'A' .. 'Z' - | '0' .. '9' + 'a' ... 'z' + | 'A' ... 'Z' + | '0' ... '9' | '_' | '.' | '$' => result.push_char(c), _ => { diff --git a/src/librustc_back/svh.rs b/src/librustc_back/svh.rs index f98a2dac0841c..f666da61b2d1c 100644 --- a/src/librustc_back/svh.rs +++ b/src/librustc_back/svh.rs @@ -110,7 +110,7 @@ impl Svh { fn hex(b: u64) -> char { let b = (b & 0xf) as u8; let b = match b { - 0 .. 9 => '0' as u8 + b, + 0 ... 9 => '0' as u8 + b, _ => 'a' as u8 + b - 10, }; b as char diff --git a/src/libserialize/base64.rs b/src/libserialize/base64.rs index f85f3a43974b9..19dcc3c132cd7 100644 --- a/src/libserialize/base64.rs +++ b/src/libserialize/base64.rs @@ -224,9 +224,9 @@ impl<'a> FromBase64 for &'a [u8] { let val = byte as u32; match byte { - b'A'..b'Z' => buf |= val - 0x41, - b'a'..b'z' => buf |= val - 0x47, - b'0'..b'9' => buf |= val + 0x04, + b'A'...b'Z' => buf |= val - 0x41, + b'a'...b'z' => buf |= val - 0x47, + b'0'...b'9' => buf |= val + 0x04, b'+' | b'-' => buf |= 0x3E, b'/' | b'_' => buf |= 0x3F, b'\r' | b'\n' => continue, diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs index 5e8697ef0ade4..ffe63f738cf97 100644 --- a/src/libserialize/hex.rs +++ b/src/libserialize/hex.rs @@ -113,9 +113,9 @@ impl<'a> FromHex for &'a str { buf <<= 4; match byte { - b'A'..b'F' => buf |= byte - b'A' + 10, - b'a'..b'f' => buf |= byte - b'a' + 10, - b'0'..b'9' => buf |= byte - b'0', + b'A'...b'F' => buf |= byte - b'A' + 10, + b'a'...b'f' => buf |= byte - b'a' + 10, + b'0'...b'9' => buf |= byte - b'0', b' '|b'\r'|b'\n'|b'\t' => { buf >>= 4; continue diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index ed95fa341b39d..3007e160bf8ae 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -1392,14 +1392,14 @@ impl> Parser { // A leading '0' must be the only digit before the decimal point. match self.ch_or_null() { - '0' .. '9' => return self.error(InvalidNumber), + '0' ... '9' => return self.error(InvalidNumber), _ => () } }, - '1' .. '9' => { + '1' ... '9' => { while !self.eof() { match self.ch_or_null() { - c @ '0' .. '9' => { + c @ '0' ... '9' => { accum *= 10; accum += (c as u64) - ('0' as u64); @@ -1423,14 +1423,14 @@ impl> Parser { // Make sure a digit follows the decimal place. match self.ch_or_null() { - '0' .. '9' => (), + '0' ... '9' => (), _ => return self.error(InvalidNumber) } let mut dec = 1.0; while !self.eof() { match self.ch_or_null() { - c @ '0' .. '9' => { + c @ '0' ... '9' => { dec /= 10.0; res += (((c as int) - ('0' as int)) as f64) * dec; self.bump(); @@ -1457,12 +1457,12 @@ impl> Parser { // Make sure a digit follows the exponent place. match self.ch_or_null() { - '0' .. '9' => (), + '0' ... '9' => (), _ => return self.error(InvalidNumber) } while !self.eof() { match self.ch_or_null() { - c @ '0' .. '9' => { + c @ '0' ... '9' => { exp *= 10; exp += (c as uint) - ('0' as uint); @@ -1488,7 +1488,7 @@ impl> Parser { while i < 4 && !self.eof() { self.bump(); n = match self.ch_or_null() { - c @ '0' .. '9' => n * 16 + ((c as u16) - ('0' as u16)), + c @ '0' ... '9' => n * 16 + ((c as u16) - ('0' as u16)), 'a' | 'A' => n * 16 + 10, 'b' | 'B' => n * 16 + 11, 'c' | 'C' => n * 16 + 12, @@ -1530,11 +1530,13 @@ impl> Parser { 'r' => res.push('\r'), 't' => res.push('\t'), 'u' => match try!(self.decode_hex_escape()) { - 0xDC00 .. 0xDFFF => return self.error(LoneLeadingSurrogateInHexEscape), + 0xDC00 ... 0xDFFF => { + return self.error(LoneLeadingSurrogateInHexEscape) + } // Non-BMP characters are encoded as a sequence of // two hex escapes, representing UTF-16 surrogates. - n1 @ 0xD800 .. 0xDBFF => { + n1 @ 0xD800 ... 0xDBFF => { match (self.next_char(), self.next_char()) { (Some('\\'), Some('u')) => (), _ => return self.error(UnexpectedEndOfHexEscape), @@ -1768,7 +1770,7 @@ impl> Parser { 'n' => { self.parse_ident("ull", NullValue) } 't' => { self.parse_ident("rue", BooleanValue(true)) } 'f' => { self.parse_ident("alse", BooleanValue(false)) } - '0' .. '9' | '-' => self.parse_number(), + '0' ... '9' | '-' => self.parse_number(), '"' => match self.parse_str() { Ok(s) => StringValue(s), Err(e) => Error(e), diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 407c8ea61d914..b15f334e233e8 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -199,8 +199,8 @@ pub fn int_to_str_bytes_common(num: T, radix: uint, sign: SignFormat, f: current_digit_signed }; buf[cur] = match current_digit.to_u8().unwrap() { - i @ 0..9 => b'0' + i, - i => b'a' + (i - 10), + i @ 0...9 => b'0' + i, + i => b'a' + (i - 10), }; cur += 1; diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 68ddd17dd012b..38c985af37082 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -637,7 +637,7 @@ impl<'a> StringReader<'a> { 'b' => { self.bump(); base = 2; num_digits = self.scan_digits(2); } 'o' => { self.bump(); base = 8; num_digits = self.scan_digits(8); } 'x' => { self.bump(); base = 16; num_digits = self.scan_digits(16); } - '0'..'9' | '_' | '.' => { + '0'...'9' | '_' | '.' => { num_digits = self.scan_digits(10) + 1; } 'u' | 'i' => { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 415ff6a4097ac..e46e67d7bd300 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3237,8 +3237,7 @@ impl<'a> Parser<'a> { // These expressions are limited to literals (possibly // preceded by unary-minus) or identifiers. let val = self.parse_literal_maybe_minus(); - // FIXME(#17295) remove the DOTDOT option. - if (self.token == token::DOTDOTDOT || self.token == token::DOTDOT) && + if (self.token == token::DOTDOTDOT) && self.look_ahead(1, |t| { *t != token::COMMA && *t != token::RBRACKET }) { @@ -3283,16 +3282,12 @@ impl<'a> Parser<'a> { } }); - // FIXME(#17295) remove the DOTDOT option. - if self.look_ahead(1, |t| *t == token::DOTDOTDOT || *t == token::DOTDOT) && + if self.look_ahead(1, |t| *t == token::DOTDOTDOT) && self.look_ahead(2, |t| { *t != token::COMMA && *t != token::RBRACKET }) { let start = self.parse_expr_res(RestrictionNoBarOp); - // FIXME(#17295) remove the DOTDOT option (self.eat(&token::DOTDOTDOT)). - if self.token == token::DOTDOTDOT || self.token == token::DOTDOT { - self.bump(); - } + self.eat(&token::DOTDOTDOT); let end = self.parse_expr_res(RestrictionNoBarOp); pat = PatRange(start, end); } else if is_plain_ident(&self.token) && !can_be_enum_or_struct { diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 3f626d716f88b..736cacbdeb78a 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -256,7 +256,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) if res.is_err() { return res } output.push_all(res.unwrap().as_slice()) } else { return Err("stack is empty".to_string()) }, - ':'|'#'|' '|'.'|'0'..'9' => { + ':'|'#'|' '|'.'|'0'...'9' => { let mut flags = Flags::new(); let mut fstate = FormatStateFlags; match cur { @@ -264,7 +264,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) '#' => flags.alternate = true, ' ' => flags.space = true, '.' => fstate = FormatStatePrecision, - '0'..'9' => { + '0'...'9' => { flags.width = cur as uint - '0' as uint; fstate = FormatStateWidth; } @@ -339,7 +339,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) stack.push(Number(i)); state = Nothing; } - '0'..'9' => { + '0'...'9' => { state = IntConstant(i*10 + (cur as int - '0' as int)); old_state = Nothing; } @@ -368,14 +368,14 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) (FormatStateFlags,' ') => { flags.space = true; } - (FormatStateFlags,'0'..'9') => { + (FormatStateFlags,'0'...'9') => { flags.width = cur as uint - '0' as uint; *fstate = FormatStateWidth; } (FormatStateFlags,'.') => { *fstate = FormatStatePrecision; } - (FormatStateWidth,'0'..'9') => { + (FormatStateWidth,'0'...'9') => { let old = flags.width; flags.width = flags.width * 10 + (cur as uint - '0' as uint); if flags.width < old { return Err("format width overflow".to_string()) } @@ -383,7 +383,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) (FormatStateWidth,'.') => { *fstate = FormatStatePrecision; } - (FormatStatePrecision,'0'..'9') => { + (FormatStatePrecision,'0'...'9') => { let old = flags.precision; flags.precision = flags.precision * 10 + (cur as uint - '0' as uint); if flags.precision < old { diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs index 9cec71104d403..4061db66ddf8f 100644 --- a/src/libtime/lib.rs +++ b/src/libtime/lib.rs @@ -447,7 +447,7 @@ pub fn strptime(s: &str, format: &str) -> Result { pos = range.next; match range.ch { - '0' .. '9' => { + '0' ... '9' => { value = value * 10_i32 + (range.ch as i32 - '0' as i32); } ' ' if ws => (), @@ -472,7 +472,7 @@ pub fn strptime(s: &str, format: &str) -> Result { let range = ss.char_range_at(pos); match range.ch { - '0' .. '9' => { + '0' ... '9' => { pos = range.next; // This will drop digits after the nanoseconds place let digit = range.ch as i32 - '0' as i32; diff --git a/src/libunicode/u_char.rs b/src/libunicode/u_char.rs index d866514385452..f725cdba64ef5 100644 --- a/src/libunicode/u_char.rs +++ b/src/libunicode/u_char.rs @@ -22,7 +22,7 @@ use tables::{derived_property, property, general_category, conversions, charwidt /// code point pub fn is_alphabetic(c: char) -> bool { match c { - 'a' .. 'z' | 'A' .. 'Z' => true, + 'a' ... 'z' | 'A' ... 'Z' => true, c if c > '\x7f' => derived_property::Alphabetic(c), _ => false } @@ -52,7 +52,7 @@ pub fn is_XID_continue(c: char) -> bool { derived_property::XID_Continue(c) } #[inline] pub fn is_lowercase(c: char) -> bool { match c { - 'a' .. 'z' => true, + 'a' ... 'z' => true, c if c > '\x7f' => derived_property::Lowercase(c), _ => false } @@ -66,7 +66,7 @@ pub fn is_lowercase(c: char) -> bool { #[inline] pub fn is_uppercase(c: char) -> bool { match c { - 'A' .. 'Z' => true, + 'A' ... 'Z' => true, c if c > '\x7f' => derived_property::Uppercase(c), _ => false } @@ -80,7 +80,7 @@ pub fn is_uppercase(c: char) -> bool { #[inline] pub fn is_whitespace(c: char) -> bool { match c { - ' ' | '\x09' .. '\x0d' => true, + ' ' | '\x09' ... '\x0d' => true, c if c > '\x7f' => property::White_Space(c), _ => false } @@ -111,7 +111,7 @@ pub fn is_control(c: char) -> bool { general_category::Cc(c) } #[inline] pub fn is_digit(c: char) -> bool { match c { - '0' .. '9' => true, + '0' ... '9' => true, c if c > '\x7f' => general_category::N(c), _ => false } diff --git a/src/liburl/lib.rs b/src/liburl/lib.rs index 0b227b68ca896..cb4940861ebc5 100644 --- a/src/liburl/lib.rs +++ b/src/liburl/lib.rs @@ -190,9 +190,9 @@ fn encode_inner(c: T, full_url: bool) -> String { c.container_as_bytes().iter().fold(String::new(), |mut out, &b| { match b as char { // unreserved: - 'A' .. 'Z' - | 'a' .. 'z' - | '0' .. '9' + 'A' ... 'Z' + | 'a' ... 'z' + | '0' ... '9' | '-' | '.' | '_' | '~' => out.push_char(b as char), // gen-delims: @@ -303,9 +303,9 @@ pub fn encode_form_urlencoded(m: &HashMap>) -> String { fn encode_plus(s: &T) -> String { s.as_slice().bytes().fold(String::new(), |mut out, b| { match b as char { - 'A' .. 'Z' - | 'a' .. 'z' - | '0' .. '9' + 'A' ... 'Z' + | 'a' ... 'z' + | '0' ... '9' | '_' | '.' | '-' => out.push_char(b as char), ' ' => out.push_char('+'), ch => out.push_str(format!("%{:X}", ch as uint).as_slice()) @@ -473,9 +473,9 @@ pub fn query_to_str(query: &Query) -> String { pub fn get_scheme(rawurl: &str) -> DecodeResult<(&str, &str)> { for (i,c) in rawurl.chars().enumerate() { let result = match c { - 'A' .. 'Z' - | 'a' .. 'z' => continue, - '0' .. '9' | '+' | '-' | '.' => { + 'A' ... 'Z' + | 'a' ... 'z' => continue, + '0' ... '9' | '+' | '-' | '.' => { if i != 0 { continue } Err("url: Scheme must begin with a letter.".to_string()) @@ -538,15 +538,15 @@ fn get_authority(rawurl: &str) -> .skip(2) { // deal with input class first match c { - '0' .. '9' => (), - 'A' .. 'F' - | 'a' .. 'f' => { + '0' ... '9' => (), + 'A' ... 'F' + | 'a' ... 'f' => { if input == Digit { input = Hex; } } - 'G' .. 'Z' - | 'g' .. 'z' + 'G' ... 'Z' + | 'g' ... 'z' | '-' | '.' | '_' | '~' | '%' | '&' |'\'' | '(' | ')' | '+' | '!' | '*' | ',' | ';' | '=' => input = Unreserved, @@ -671,9 +671,9 @@ fn get_path(rawurl: &str, is_authority: bool) -> DecodeResult<(String, &str)> { let mut end = len; for (i,c) in rawurl.chars().enumerate() { match c { - 'A' .. 'Z' - | 'a' .. 'z' - | '0' .. '9' + 'A' ... 'Z' + | 'a' ... 'z' + | '0' ... '9' | '&' |'\'' | '(' | ')' | '.' | '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '=' diff --git a/src/libuuid/lib.rs b/src/libuuid/lib.rs index 09dc8166908d9..f728205c3a57f 100644 --- a/src/libuuid/lib.rs +++ b/src/libuuid/lib.rs @@ -387,7 +387,7 @@ impl Uuid { // Make sure all chars are either hex digits or hyphen for (i, c) in us.chars().enumerate() { match c { - '0'..'9' | 'A'..'F' | 'a'..'f' | '-' => {}, + '0'...'9' | 'A'...'F' | 'a'...'f' | '-' => {}, _ => return Err(ErrorInvalidCharacter(c, i)), } } diff --git a/src/test/compile-fail/match-ill-type1.rs b/src/test/compile-fail/match-ill-type1.rs index 5ffcb26e12ed5..2b4c77bf9e873 100644 --- a/src/test/compile-fail/match-ill-type1.rs +++ b/src/test/compile-fail/match-ill-type1.rs @@ -10,7 +10,7 @@ fn main() { match 1 { - 1..2u => 1, //~ ERROR mismatched types in range + 1...2u => 1, //~ ERROR mismatched types in range _ => 2, }; } diff --git a/src/test/compile-fail/match-range-fail-dominate.rs b/src/test/compile-fail/match-range-fail-dominate.rs index 7c9c371c52674..7a4451f99ab0c 100644 --- a/src/test/compile-fail/match-range-fail-dominate.rs +++ b/src/test/compile-fail/match-range-fail-dominate.rs @@ -16,31 +16,31 @@ fn main() { match 5u { - 1u .. 10u => { } - 5u .. 6u => { } + 1u ... 10u => { } + 5u ... 6u => { } _ => {} }; match 5u { - 3u .. 6u => { } - 4u .. 6u => { } + 3u ... 6u => { } + 4u ... 6u => { } _ => {} }; match 5u { - 4u .. 6u => { } - 4u .. 6u => { } + 4u ... 6u => { } + 4u ... 6u => { } _ => {} }; match 'c' { - 'A' .. 'z' => {} - 'a' .. 'z' => {} + 'A' ... 'z' => {} + 'a' ... 'z' => {} _ => {} }; match 1.0f64 { - 0.01f64 .. 6.5f64 => {} + 0.01f64 ... 6.5f64 => {} 0.02f64 => {} _ => {} }; diff --git a/src/test/compile-fail/match-range-fail.rs b/src/test/compile-fail/match-range-fail.rs index 5ac1eb8572fda..9fbd1545fcf67 100644 --- a/src/test/compile-fail/match-range-fail.rs +++ b/src/test/compile-fail/match-range-fail.rs @@ -14,16 +14,16 @@ fn main() { match 5u { - 6u .. 1u => { } + 6u ... 1u => { } _ => { } }; match "wow" { - "bar" .. "foo" => { } + "bar" ... "foo" => { } }; match 5u { - 'c' .. 100u => { } + 'c' ... 100u => { } _ => { } }; } diff --git a/src/test/compile-fail/refutable-pattern-errors.rs b/src/test/compile-fail/refutable-pattern-errors.rs index 28533518a25a1..98d616ee3afb5 100644 --- a/src/test/compile-fail/refutable-pattern-errors.rs +++ b/src/test/compile-fail/refutable-pattern-errors.rs @@ -9,10 +9,10 @@ // except according to those terms. -fn func((1, (Some(1), 2..3)): (int, (Option, int))) { } +fn func((1, (Some(1), 2...3)): (int, (Option, int))) { } //~^ ERROR refutable pattern in function argument: `(_, _)` not covered fn main() { - let (1i, (Some(1i), 2i..3i)) = (1i, (None, 2i)); + let (1i, (Some(1i), 2i...3i)) = (1i, (None, 2i)); //~^ ERROR refutable pattern in local binding: `(_, _)` not covered } diff --git a/src/test/run-pass/byte-literals.rs b/src/test/run-pass/byte-literals.rs index 058dc426766bc..aa45bfd14541c 100644 --- a/src/test/run-pass/byte-literals.rs +++ b/src/test/run-pass/byte-literals.rs @@ -33,7 +33,7 @@ pub fn main() { } match 100 { - b'a' .. b'z' => {}, + b'a' ... b'z' => {}, _ => fail!() } diff --git a/src/test/run-pass/inferred-suffix-in-pattern-range.rs b/src/test/run-pass/inferred-suffix-in-pattern-range.rs index a7b2a46f0c3a4..a104ee6baaace 100644 --- a/src/test/run-pass/inferred-suffix-in-pattern-range.rs +++ b/src/test/run-pass/inferred-suffix-in-pattern-range.rs @@ -11,21 +11,21 @@ pub fn main() { let x = 2i; let x_message = match x { - 0 .. 1 => { "not many".to_string() } + 0 ... 1 => { "not many".to_string() } _ => { "lots".to_string() } }; assert_eq!(x_message, "lots".to_string()); let y = 2i; let y_message = match y { - 0 .. 1 => { "not many".to_string() } + 0 ... 1 => { "not many".to_string() } _ => { "lots".to_string() } }; assert_eq!(y_message, "lots".to_string()); let z = 1u64; let z_message = match z { - 0 .. 1 => { "not many".to_string() } + 0 ... 1 => { "not many".to_string() } _ => { "lots".to_string() } }; assert_eq!(z_message, "not many".to_string()); diff --git a/src/test/run-pass/issue-12582.rs b/src/test/run-pass/issue-12582.rs index f68ba5dab8ae2..ab2abc094f4db 100644 --- a/src/test/run-pass/issue-12582.rs +++ b/src/test/run-pass/issue-12582.rs @@ -17,7 +17,7 @@ pub fn main() { assert_eq!(3i, match (x, y) { (1, 1) => 1, (2, 2) => 2, - (1..2, 2) => 3, + (1...2, 2) => 3, _ => 4, }); @@ -25,7 +25,7 @@ pub fn main() { assert_eq!(3i, match ((x, y),) { ((1, 1),) => 1, ((2, 2),) => 2, - ((1..2, 2),) => 3, + ((1...2, 2),) => 3, _ => 4, }); } diff --git a/src/test/run-pass/issue-13027.rs b/src/test/run-pass/issue-13027.rs index 0efe64448c3d0..6cd098aeb0f8c 100644 --- a/src/test/run-pass/issue-13027.rs +++ b/src/test/run-pass/issue-13027.rs @@ -31,7 +31,7 @@ pub fn main() { fn lit_shadow_range() { assert_eq!(2i, match 1i { 1 if false => 1i, - 1..2 => 2, + 1...2 => 2, _ => 3 }); @@ -39,34 +39,34 @@ fn lit_shadow_range() { assert_eq!(2i, match x+1 { 0 => 0i, 1 if false => 1, - 1..2 => 2, + 1...2 => 2, _ => 3 }); assert_eq!(2i, match val() { 1 if false => 1i, - 1..2 => 2, + 1...2 => 2, _ => 3 }); assert_eq!(2i, match CONST { 0 => 0i, 1 if false => 1, - 1..2 => 2, + 1...2 => 2, _ => 3 }); // value is out of the range of second arm, should match wildcard pattern assert_eq!(3i, match 3i { 1 if false => 1i, - 1..2 => 2, + 1...2 => 2, _ => 3 }); } fn range_shadow_lit() { assert_eq!(2i, match 1i { - 1..2 if false => 1i, + 1...2 if false => 1i, 1 => 2, _ => 3 }); @@ -74,27 +74,27 @@ fn range_shadow_lit() { let x = 0i; assert_eq!(2i, match x+1 { 0 => 0i, - 1..2 if false => 1, + 1...2 if false => 1, 1 => 2, _ => 3 }); assert_eq!(2i, match val() { - 1..2 if false => 1i, + 1...2 if false => 1i, 1 => 2, _ => 3 }); assert_eq!(2i, match CONST { 0 => 0i, - 1..2 if false => 1, + 1...2 if false => 1, 1 => 2, _ => 3 }); // ditto assert_eq!(3i, match 3i { - 1..2 if false => 1i, + 1...2 if false => 1i, 1 => 2, _ => 3 }); @@ -102,36 +102,36 @@ fn range_shadow_lit() { fn range_shadow_range() { assert_eq!(2i, match 1i { - 0..2 if false => 1i, - 1..3 => 2, + 0...2 if false => 1i, + 1...3 => 2, _ => 3, }); let x = 0i; assert_eq!(2i, match x+1 { 100 => 0, - 0..2 if false => 1, - 1..3 => 2, + 0...2 if false => 1, + 1...3 => 2, _ => 3, }); assert_eq!(2i, match val() { - 0..2 if false => 1, - 1..3 => 2, + 0...2 if false => 1, + 1...3 => 2, _ => 3, }); assert_eq!(2i, match CONST { 100 => 0, - 0..2 if false => 1, - 1..3 => 2, + 0...2 if false => 1, + 1...3 => 2, _ => 3, }); // ditto assert_eq!(3i, match 5i { - 0..2 if false => 1i, - 1..3 => 2, + 0...2 if false => 1i, + 1...3 => 2, _ => 3, }); } @@ -139,7 +139,7 @@ fn range_shadow_range() { fn multi_pats_shadow_lit() { assert_eq!(2i, match 1i { 100 => 0i, - 0 | 1..10 if false => 1, + 0 | 1...10 if false => 1, 1 => 2, _ => 3, }); @@ -148,8 +148,8 @@ fn multi_pats_shadow_lit() { fn multi_pats_shadow_range() { assert_eq!(2i, match 1i { 100 => 0i, - 0 | 1..10 if false => 1, - 1..3 => 2, + 0 | 1...10 if false => 1, + 1...3 => 2, _ => 3, }); } @@ -158,7 +158,7 @@ fn lit_shadow_multi_pats() { assert_eq!(2i, match 1i { 100 => 0i, 1 if false => 1, - 0 | 1..10 => 2, + 0 | 1...10 => 2, _ => 3, }); } @@ -166,8 +166,8 @@ fn lit_shadow_multi_pats() { fn range_shadow_multi_pats() { assert_eq!(2i, match 1i { 100 => 0i, - 1..3 if false => 1, - 0 | 1..10 => 2, + 1...3 if false => 1, + 0 | 1...10 => 2, _ => 3, }); } diff --git a/src/test/run-pass/issue-13867.rs b/src/test/run-pass/issue-13867.rs index 8bea2e7804602..b1607ef174bb2 100644 --- a/src/test/run-pass/issue-13867.rs +++ b/src/test/run-pass/issue-13867.rs @@ -18,14 +18,14 @@ enum Foo { fn main() { let r = match (FooNullary, 'a') { - (FooUint(..), 'a'..'z') => 1i, + (FooUint(..), 'a'...'z') => 1i, (FooNullary, 'x') => 2i, _ => 0 }; assert_eq!(r, 0); let r = match (FooUint(0), 'a') { - (FooUint(1), 'a'..'z') => 1i, + (FooUint(1), 'a'...'z') => 1i, (FooUint(..), 'x') => 2i, (FooNullary, 'a') => 3i, _ => 0 @@ -33,7 +33,7 @@ fn main() { assert_eq!(r, 0); let r = match ('a', FooUint(0)) { - ('a'..'z', FooUint(1)) => 1i, + ('a'...'z', FooUint(1)) => 1i, ('x', FooUint(..)) => 2i, ('a', FooNullary) => 3i, _ => 0 @@ -41,15 +41,15 @@ fn main() { assert_eq!(r, 0); let r = match ('a', 'a') { - ('a'..'z', 'b') => 1i, - ('x', 'a'..'z') => 2i, + ('a'...'z', 'b') => 1i, + ('x', 'a'...'z') => 2i, _ => 0 }; assert_eq!(r, 0); let r = match ('a', 'a') { - ('a'..'z', 'b') => 1i, - ('x', 'a'..'z') => 2i, + ('a'...'z', 'b') => 1i, + ('x', 'a'...'z') => 2i, ('a', 'a') => 3i, _ => 0 }; diff --git a/src/test/run-pass/issue-7222.rs b/src/test/run-pass/issue-7222.rs index 5db170fd52100..b86b9a83e35bc 100644 --- a/src/test/run-pass/issue-7222.rs +++ b/src/test/run-pass/issue-7222.rs @@ -12,7 +12,7 @@ pub fn main() { static FOO: f64 = 10.0; match 0.0 { - 0.0 .. FOO => (), + 0.0 ... FOO => (), _ => () } } diff --git a/src/test/run-pass/match-range.rs b/src/test/run-pass/match-range.rs index 8b782520536a0..4761d2606fc2a 100644 --- a/src/test/run-pass/match-range.rs +++ b/src/test/run-pass/match-range.rs @@ -12,32 +12,32 @@ pub fn main() { match 5u { - 1u..5u => {} + 1u...5u => {} _ => fail!("should match range"), } match 5u { - 6u..7u => fail!("shouldn't match range"), + 6u...7u => fail!("shouldn't match range"), _ => {} } match 5u { 1u => fail!("should match non-first range"), - 2u..6u => {} + 2u...6u => {} _ => fail!("math is broken") } match 'c' { - 'a'..'z' => {} + 'a'...'z' => {} _ => fail!("should suppport char ranges") } match -3i { - -7..5 => {} + -7...5 => {} _ => fail!("should match signed range") } match 3.0f64 { - 1.0..5.0 => {} + 1.0...5.0 => {} _ => fail!("should match float range") } match -1.5f64 { - -3.6..3.6 => {} + -3.6...3.6 => {} _ => fail!("should match negative float range") } }