Skip to content

Commit c434954

Browse files
author
Jorge Aparicio
committed
libsyntax: use tuple indexing
1 parent 4fd6a99 commit c434954

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/libsyntax/parse/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ pub fn str_lit(lit: &str) -> String {
431431
/// Eat everything up to a non-whitespace
432432
fn eat<'a>(it: &mut iter::Peekable<(uint, char), str::CharOffsets<'a>>) {
433433
loop {
434-
match it.peek().map(|x| x.val1()) {
434+
match it.peek().map(|x| x.1) {
435435
Some(' ') | Some('\n') | Some('\r') | Some('\t') => {
436436
it.next();
437437
},
@@ -448,15 +448,15 @@ pub fn str_lit(lit: &str) -> String {
448448
'\\' => {
449449
let ch = chars.peek().unwrap_or_else(|| {
450450
panic!("{}", error(i).as_slice())
451-
}).val1();
451+
}).1;
452452

453453
if ch == '\n' {
454454
eat(&mut chars);
455455
} else if ch == '\r' {
456456
chars.next();
457457
let ch = chars.peek().unwrap_or_else(|| {
458458
panic!("{}", error(i).as_slice())
459-
}).val1();
459+
}).1;
460460

461461
if ch != '\n' {
462462
panic!("lexer accepted bare CR");
@@ -474,7 +474,7 @@ pub fn str_lit(lit: &str) -> String {
474474
'\r' => {
475475
let ch = chars.peek().unwrap_or_else(|| {
476476
panic!("{}", error(i).as_slice())
477-
}).val1();
477+
}).1;
478478

479479
if ch != '\n' {
480480
panic!("lexer accepted bare CR");
@@ -600,7 +600,7 @@ pub fn binary_lit(lit: &str) -> Rc<Vec<u8>> {
600600
/// Eat everything up to a non-whitespace
601601
fn eat<'a, I: Iterator<(uint, u8)>>(it: &mut iter::Peekable<(uint, u8), I>) {
602602
loop {
603-
match it.peek().map(|x| x.val1()) {
603+
match it.peek().map(|x| x.1) {
604604
Some(b' ') | Some(b'\n') | Some(b'\r') | Some(b'\t') => {
605605
it.next();
606606
},
@@ -615,11 +615,11 @@ pub fn binary_lit(lit: &str) -> Rc<Vec<u8>> {
615615
match chars.next() {
616616
Some((i, b'\\')) => {
617617
let em = error(i);
618-
match chars.peek().expect(em.as_slice()).val1() {
618+
match chars.peek().expect(em.as_slice()).1 {
619619
b'\n' => eat(&mut chars),
620620
b'\r' => {
621621
chars.next();
622-
if chars.peek().expect(em.as_slice()).val1() != b'\n' {
622+
if chars.peek().expect(em.as_slice()).1 != b'\n' {
623623
panic!("lexer accepted bare CR");
624624
}
625625
eat(&mut chars);
@@ -637,7 +637,7 @@ pub fn binary_lit(lit: &str) -> Rc<Vec<u8>> {
637637
},
638638
Some((i, b'\r')) => {
639639
let em = error(i);
640-
if chars.peek().expect(em.as_slice()).val1() != b'\n' {
640+
if chars.peek().expect(em.as_slice()).1 != b'\n' {
641641
panic!("lexer accepted bare CR");
642642
}
643643
chars.next();

src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,8 +1740,8 @@ impl<'a> Parser<'a> {
17401740
}
17411741
token::Literal(lit, suf) => {
17421742
let (suffix_illegal, out) = match lit {
1743-
token::Byte(i) => (true, LitByte(parse::byte_lit(i.as_str()).val0())),
1744-
token::Char(i) => (true, LitChar(parse::char_lit(i.as_str()).val0())),
1743+
token::Byte(i) => (true, LitByte(parse::byte_lit(i.as_str()).0)),
1744+
token::Char(i) => (true, LitChar(parse::char_lit(i.as_str()).0)),
17451745

17461746
// there are some valid suffixes for integer and
17471747
// float literals, so all the handling is done

0 commit comments

Comments
 (0)