]> git.lizzy.rs Git - rust.git/commitdiff
libsyntax: use tuple indexing
authorJorge Aparicio <japaricious@gmail.com>
Tue, 9 Dec 2014 17:17:24 +0000 (12:17 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Sun, 14 Dec 2014 01:04:40 +0000 (20:04 -0500)
src/libsyntax/parse/mod.rs
src/libsyntax/parse/parser.rs

index 951fe11a470bb5b28a0cc352f99984ff39d62f83..310d5662afa20aab56f1d237e07ee2e93b7be2b9 100644 (file)
@@ -431,7 +431,7 @@ pub fn str_lit(lit: &str) -> String {
     /// Eat everything up to a non-whitespace
     fn eat<'a>(it: &mut iter::Peekable<(uint, char), str::CharOffsets<'a>>) {
         loop {
-            match it.peek().map(|x| x.val1()) {
+            match it.peek().map(|x| x.1) {
                 Some(' ') | Some('\n') | Some('\r') | Some('\t') => {
                     it.next();
                 },
@@ -448,7 +448,7 @@ fn eat<'a>(it: &mut iter::Peekable<(uint, char), str::CharOffsets<'a>>) {
                     '\\' => {
                         let ch = chars.peek().unwrap_or_else(|| {
                             panic!("{}", error(i).as_slice())
-                        }).val1();
+                        }).1;
 
                         if ch == '\n' {
                             eat(&mut chars);
@@ -456,7 +456,7 @@ fn eat<'a>(it: &mut iter::Peekable<(uint, char), str::CharOffsets<'a>>) {
                             chars.next();
                             let ch = chars.peek().unwrap_or_else(|| {
                                 panic!("{}", error(i).as_slice())
-                            }).val1();
+                            }).1;
 
                             if ch != '\n' {
                                 panic!("lexer accepted bare CR");
@@ -474,7 +474,7 @@ fn eat<'a>(it: &mut iter::Peekable<(uint, char), str::CharOffsets<'a>>) {
                     '\r' => {
                         let ch = chars.peek().unwrap_or_else(|| {
                             panic!("{}", error(i).as_slice())
-                        }).val1();
+                        }).1;
 
                         if ch != '\n' {
                             panic!("lexer accepted bare CR");
@@ -600,7 +600,7 @@ pub fn binary_lit(lit: &str) -> Rc<Vec<u8>> {
     /// Eat everything up to a non-whitespace
     fn eat<'a, I: Iterator<(uint, u8)>>(it: &mut iter::Peekable<(uint, u8), I>) {
         loop {
-            match it.peek().map(|x| x.val1()) {
+            match it.peek().map(|x| x.1) {
                 Some(b' ') | Some(b'\n') | Some(b'\r') | Some(b'\t') => {
                     it.next();
                 },
@@ -615,11 +615,11 @@ fn eat<'a, I: Iterator<(uint, u8)>>(it: &mut iter::Peekable<(uint, u8), I>) {
         match chars.next() {
             Some((i, b'\\')) => {
                 let em = error(i);
-                match chars.peek().expect(em.as_slice()).val1() {
+                match chars.peek().expect(em.as_slice()).1 {
                     b'\n' => eat(&mut chars),
                     b'\r' => {
                         chars.next();
-                        if chars.peek().expect(em.as_slice()).val1() != b'\n' {
+                        if chars.peek().expect(em.as_slice()).1 != b'\n' {
                             panic!("lexer accepted bare CR");
                         }
                         eat(&mut chars);
@@ -637,7 +637,7 @@ fn eat<'a, I: Iterator<(uint, u8)>>(it: &mut iter::Peekable<(uint, u8), I>) {
             },
             Some((i, b'\r')) => {
                 let em = error(i);
-                if chars.peek().expect(em.as_slice()).val1() != b'\n' {
+                if chars.peek().expect(em.as_slice()).1 != b'\n' {
                     panic!("lexer accepted bare CR");
                 }
                 chars.next();
index 8c44f9fdf26b7ea8f09cc8fd77fc610e7546488e..e9cc91d94151a2f231a252ea3c856dbdba1b1b02 100644 (file)
@@ -1740,8 +1740,8 @@ pub fn lit_from_token(&mut self, tok: &token::Token) -> Lit_ {
             }
             token::Literal(lit, suf) => {
                 let (suffix_illegal, out) = match lit {
-                    token::Byte(i) => (true, LitByte(parse::byte_lit(i.as_str()).val0())),
-                    token::Char(i) => (true, LitChar(parse::char_lit(i.as_str()).val0())),
+                    token::Byte(i) => (true, LitByte(parse::byte_lit(i.as_str()).0)),
+                    token::Char(i) => (true, LitChar(parse::char_lit(i.as_str()).0)),
 
                     // there are some valid suffixes for integer and
                     // float literals, so all the handling is done