From a4541b02a33e7c4fdcc8f50459bad6ab99463919 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Wed, 15 Apr 2015 20:56:16 -0700 Subject: syntax: remove #![feature(box_syntax, box_patterns)] --- src/libsyntax/parse/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libsyntax/parse/mod.rs') diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 4b7b7b66582..c078787120f 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -288,7 +288,7 @@ pub fn filemap_to_tts(sess: &ParseSess, filemap: Rc) // parsing tt's probably shouldn't require a parser at all. let cfg = Vec::new(); let srdr = lexer::StringReader::new(&sess.span_diagnostic, filemap); - let mut p1 = Parser::new(sess, cfg, box srdr); + let mut p1 = Parser::new(sess, cfg, Box::new(srdr)); panictry!(p1.parse_all_token_trees()) } @@ -297,7 +297,7 @@ pub fn tts_to_parser<'a>(sess: &'a ParseSess, tts: Vec, cfg: ast::CrateConfig) -> Parser<'a> { let trdr = lexer::new_tt_reader(&sess.span_diagnostic, None, None, tts); - let mut p = Parser::new(sess, cfg, box trdr); + let mut p = Parser::new(sess, cfg, Box::new(trdr)); panictry!(p.check_unknown_macro_variable()); p } @@ -360,7 +360,7 @@ pub mod with_hygiene { use super::lexer::make_reader_with_embedded_idents as make_reader; let cfg = Vec::new(); let srdr = make_reader(&sess.span_diagnostic, filemap); - let mut p1 = Parser::new(sess, cfg, box srdr); + let mut p1 = Parser::new(sess, cfg, Box::new(srdr)); panictry!(p1.parse_all_token_trees()) } } -- cgit 1.4.1-3-g733a5 From ca0ee4c6454fd272457e98c20a461ec9f93b2ac4 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Wed, 15 Apr 2015 22:12:12 -0700 Subject: syntax: Remove uses of #[feature(slice_patterns)] --- src/libsyntax/config.rs | 11 +++++-- src/libsyntax/diagnostics/plugin.rs | 23 ++++++++------ src/libsyntax/ext/deriving/cmp/ord.rs | 4 +-- src/libsyntax/ext/deriving/cmp/partial_eq.rs | 8 ++--- src/libsyntax/ext/deriving/cmp/partial_ord.rs | 8 ++--- src/libsyntax/ext/deriving/hash.rs | 4 +-- src/libsyntax/ext/deriving/primitive.rs | 4 +-- src/libsyntax/ext/expand.rs | 4 +-- src/libsyntax/ext/trace_macros.rs | 7 ++-- src/libsyntax/lib.rs | 1 - src/libsyntax/parse/mod.rs | 46 ++++++++++++++++++--------- 11 files changed, 73 insertions(+), 47 deletions(-) (limited to 'src/libsyntax/parse/mod.rs') diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs index 489a7721d7b..366806bc19b 100644 --- a/src/libsyntax/config.rs +++ b/src/libsyntax/config.rs @@ -284,8 +284,15 @@ impl<'a> fold::Folder for CfgAttrFolder<'a> { return fold::noop_fold_attribute(attr, self); } - let (cfg, mi) = match attr.meta_item_list() { - Some([ref cfg, ref mi]) => (cfg, mi), + let attr_list = match attr.meta_item_list() { + Some(attr_list) => attr_list, + None => { + self.diag.span_err(attr.span, "expected `#[cfg_attr(, )]`"); + return None; + } + }; + let (cfg, mi) = match (attr_list.len(), attr_list.get(0), attr_list.get(1)) { + (2, Some(cfg), Some(mi)) => (cfg, mi), _ => { self.diag.span_err(attr.span, "expected `#[cfg_attr(, )]`"); return None; diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 6fcf39f0b17..ac25a303182 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -54,8 +54,8 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt, span: Span, token_tree: &[TokenTree]) -> Box { - let code = match token_tree { - [ast::TtToken(_, token::Ident(code, _))] => code, + let code = match (token_tree.len(), token_tree.get(0)) { + (1, Some(&ast::TtToken(_, token::Ident(code, _)))) => code, _ => unreachable!() }; with_used_diagnostics(|diagnostics| { @@ -84,13 +84,18 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt, span: Span, token_tree: &[TokenTree]) -> Box { - let (code, description) = match token_tree { - [ast::TtToken(_, token::Ident(ref code, _))] => { + let (code, description) = match ( + token_tree.len(), + token_tree.get(0), + token_tree.get(1), + token_tree.get(2) + ) { + (1, Some(&ast::TtToken(_, token::Ident(ref code, _))), None, None) => { (code, None) }, - [ast::TtToken(_, token::Ident(ref code, _)), - ast::TtToken(_, token::Comma), - ast::TtToken(_, token::Literal(token::StrRaw(description, _), None))] => { + (3, Some(&ast::TtToken(_, token::Ident(ref code, _))), + Some(&ast::TtToken(_, token::Comma)), + Some(&ast::TtToken(_, token::Literal(token::StrRaw(description, _), None)))) => { (code, Some(description)) } _ => unreachable!() @@ -130,8 +135,8 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, span: Span, token_tree: &[TokenTree]) -> Box { - let name = match token_tree { - [ast::TtToken(_, token::Ident(ref name, _))] => name, + let name = match (token_tree.len(), token_tree.get(0)) { + (1, Some(&ast::TtToken(_, token::Ident(ref name, _)))) => name, _ => unreachable!() }; diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs index b2a4ef1dafb..94cc0d9c493 100644 --- a/src/libsyntax/ext/deriving/cmp/ord.rs +++ b/src/libsyntax/ext/deriving/cmp/ord.rs @@ -106,8 +106,8 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span, // } let new = { - let other_f = match other_fs { - [ref o_f] => o_f, + let other_f = match (other_fs.len(), other_fs.get(0)) { + (1, Some(o_f)) => o_f, _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`"), }; diff --git a/src/libsyntax/ext/deriving/cmp/partial_eq.rs b/src/libsyntax/ext/deriving/cmp/partial_eq.rs index f02e5ee1412..61eb81c6755 100644 --- a/src/libsyntax/ext/deriving/cmp/partial_eq.rs +++ b/src/libsyntax/ext/deriving/cmp/partial_eq.rs @@ -29,8 +29,8 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt, cs_fold( true, // use foldl |cx, span, subexpr, self_f, other_fs| { - let other_f = match other_fs { - [ref o_f] => o_f, + let other_f = match (other_fs.len(), other_fs.get(0)) { + (1, Some(o_f)) => o_f, _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`") }; @@ -46,8 +46,8 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt, cs_fold( true, // use foldl |cx, span, subexpr, self_f, other_fs| { - let other_f = match other_fs { - [ref o_f] => o_f, + let other_f = match (other_fs.len(), other_fs.get(0)) { + (1, Some(o_f)) => o_f, _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`") }; diff --git a/src/libsyntax/ext/deriving/cmp/partial_ord.rs b/src/libsyntax/ext/deriving/cmp/partial_ord.rs index fe6a8fea78c..dbb779decac 100644 --- a/src/libsyntax/ext/deriving/cmp/partial_ord.rs +++ b/src/libsyntax/ext/deriving/cmp/partial_ord.rs @@ -150,8 +150,8 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span, // } let new = { - let other_f = match other_fs { - [ref o_f] => o_f, + let other_f = match (other_fs.len(), other_fs.get(0)) { + (1, Some(o_f)) => o_f, _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`"), }; @@ -208,8 +208,8 @@ fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt, get use the binops to avoid auto-deref dereferencing too many layers of pointers, if the type includes pointers. */ - let other_f = match other_fs { - [ref o_f] => o_f, + let other_f = match (other_fs.len(), other_fs.get(0)) { + (1, Some(o_f)) => o_f, _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`") }; diff --git a/src/libsyntax/ext/deriving/hash.rs b/src/libsyntax/ext/deriving/hash.rs index 915d9979615..b9835eda791 100644 --- a/src/libsyntax/ext/deriving/hash.rs +++ b/src/libsyntax/ext/deriving/hash.rs @@ -56,8 +56,8 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt, } fn hash_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P { - let state_expr = match substr.nonself_args { - [ref state_expr] => state_expr, + let state_expr = match (substr.nonself_args.len(), substr.nonself_args.get(0)) { + (1, Some(o_f)) => o_f, _ => cx.span_bug(trait_span, "incorrect number of arguments in `derive(Hash)`") }; let call_hash = |span, thing_expr| { diff --git a/src/libsyntax/ext/deriving/primitive.rs b/src/libsyntax/ext/deriving/primitive.rs index 3d0645fd6e3..a972cfe1355 100644 --- a/src/libsyntax/ext/deriving/primitive.rs +++ b/src/libsyntax/ext/deriving/primitive.rs @@ -71,8 +71,8 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt, } fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P { - let n = match substr.nonself_args { - [ref n] => n, + let n = match (substr.nonself_args.len(), substr.nonself_args.get(0)) { + (1, Some(o_f)) => o_f, _ => cx.span_bug(trait_span, "incorrect number of arguments in `derive(FromPrimitive)`") }; diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 0945f8dd021..d1db956adb3 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1962,8 +1962,8 @@ foo_module!(); "xx" == string }).collect(); let cxbinds: &[&ast::Ident] = &cxbinds[..]; - let cxbind = match cxbinds { - [b] => b, + let cxbind = match (cxbinds.len(), cxbinds.get(0)) { + (1, Some(b)) => *b, _ => panic!("expected just one binding for ext_cx") }; let resolved_binding = mtwt::resolve(*cxbind); diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs index 3fcc6a8d692..646e6fec405 100644 --- a/src/libsyntax/ext/trace_macros.rs +++ b/src/libsyntax/ext/trace_macros.rs @@ -28,12 +28,11 @@ pub fn expand_trace_macros(cx: &mut ExtCtxt, return base::DummyResult::any(sp); } - - match tt { - [ast::TtToken(_, ref tok)] if tok.is_keyword(keywords::True) => { + match (tt.len(), tt.first()) { + (1, Some(&ast::TtToken(_, ref tok))) if tok.is_keyword(keywords::True) => { cx.set_trace_macros(true); } - [ast::TtToken(_, ref tok)] if tok.is_keyword(keywords::False) => { + (1, Some(&ast::TtToken(_, ref tok))) if tok.is_keyword(keywords::False) => { cx.set_trace_macros(false); } _ => cx.span_err(sp, "trace_macros! accepts only `true` or `false`"), diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 99fb2798e7a..a70707b3ea1 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -35,7 +35,6 @@ #![feature(path_ext)] #![feature(str_char)] #![feature(into_cow)] -#![feature(slice_patterns)] extern crate arena; extern crate fmt_macros; diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index c078787120f..51fb09a7526 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -834,28 +834,44 @@ mod test { fn string_to_tts_macro () { let tts = string_to_tts("macro_rules! zip (($a)=>($a))".to_string()); let tts: &[ast::TokenTree] = &tts[..]; - match tts { - [ast::TtToken(_, token::Ident(name_macro_rules, token::Plain)), - ast::TtToken(_, token::Not), - ast::TtToken(_, token::Ident(name_zip, token::Plain)), - ast::TtDelimited(_, ref macro_delimed)] + + match (tts.len(), tts.get(0), tts.get(1), tts.get(2), tts.get(3)) { + ( + 4, + Some(&ast::TtToken(_, token::Ident(name_macro_rules, token::Plain))), + Some(&ast::TtToken(_, token::Not)), + Some(&ast::TtToken(_, token::Ident(name_zip, token::Plain))), + Some(&ast::TtDelimited(_, ref macro_delimed)), + ) if name_macro_rules.as_str() == "macro_rules" && name_zip.as_str() == "zip" => { - match ¯o_delimed.tts[..] { - [ast::TtDelimited(_, ref first_delimed), - ast::TtToken(_, token::FatArrow), - ast::TtDelimited(_, ref second_delimed)] + let tts = ¯o_delimed.tts[..]; + match (tts.len(), tts.get(0), tts.get(1), tts.get(2)) { + ( + 3, + Some(&ast::TtDelimited(_, ref first_delimed)), + Some(&ast::TtToken(_, token::FatArrow)), + Some(&ast::TtDelimited(_, ref second_delimed)), + ) if macro_delimed.delim == token::Paren => { - match &first_delimed.tts[..] { - [ast::TtToken(_, token::Dollar), - ast::TtToken(_, token::Ident(name, token::Plain))] + let tts = &first_delimed.tts[..]; + match (tts.len(), tts.get(0), tts.get(1)) { + ( + 2, + Some(&ast::TtToken(_, token::Dollar)), + Some(&ast::TtToken(_, token::Ident(name, token::Plain))), + ) if first_delimed.delim == token::Paren && name.as_str() == "a" => {}, _ => panic!("value 3: {:?}", **first_delimed), } - match &second_delimed.tts[..] { - [ast::TtToken(_, token::Dollar), - ast::TtToken(_, token::Ident(name, token::Plain))] + let tts = &second_delimed.tts[..]; + match (tts.len(), tts.get(0), tts.get(1)) { + ( + 2, + Some(&ast::TtToken(_, token::Dollar)), + Some(&ast::TtToken(_, token::Ident(name, token::Plain))), + ) if second_delimed.delim == token::Paren && name.as_str() == "a" => {}, _ => panic!("value 4: {:?}", **second_delimed), -- cgit 1.4.1-3-g733a5 From 19c8d701743922a709a4eb6554f562996b7baa27 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Tue, 21 Apr 2015 10:19:53 -0700 Subject: syntax: Copy unstable str::char_at into libsyntax --- src/libsyntax/lib.rs | 1 + src/libsyntax/parse/lexer/comments.rs | 7 ++++--- src/libsyntax/parse/lexer/mod.rs | 19 ++++++++++--------- src/libsyntax/parse/mod.rs | 8 ++++---- src/libsyntax/str.rs | 13 +++++++++++++ src/libsyntax/util/parser_testing.rs | 13 +++++++------ 6 files changed, 39 insertions(+), 22 deletions(-) create mode 100644 src/libsyntax/str.rs (limited to 'src/libsyntax/parse/mod.rs') diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 82f6be38797..d8beeb6a550 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -92,6 +92,7 @@ pub mod parse; pub mod ptr; pub mod show_span; pub mod std_inject; +pub mod str; pub mod test; pub mod visit; diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs index 02f1a52aaf3..fb3a96f4c28 100644 --- a/src/libsyntax/parse/lexer/comments.rs +++ b/src/libsyntax/parse/lexer/comments.rs @@ -13,11 +13,12 @@ pub use self::CommentStyle::*; use ast; use codemap::{BytePos, CharPos, CodeMap, Pos}; use diagnostic; -use parse::lexer::{is_whitespace, Reader}; -use parse::lexer::{StringReader, TokenAndSpan}; use parse::lexer::is_block_doc_comment; +use parse::lexer::{StringReader, TokenAndSpan}; +use parse::lexer::{is_whitespace, Reader}; use parse::lexer; use print::pprust; +use str::char_at; use std::io::Read; use std::usize; @@ -209,7 +210,7 @@ fn all_whitespace(s: &str, col: CharPos) -> Option { let mut col = col.to_usize(); let mut cursor: usize = 0; while col > 0 && cursor < len { - let ch = s.char_at(cursor); + let ch = char_at(s, cursor); if !ch.is_whitespace() { return None; } diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 9cd3db45784..8e37b983e21 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -13,8 +13,9 @@ use codemap::{BytePos, CharPos, CodeMap, Pos, Span}; use codemap; use diagnostic::SpanHandler; use ext::tt::transcribe::tt_next_token; -use parse::token; use parse::token::str_to_ident; +use parse::token; +use str::char_at; use std::borrow::Cow; use std::char; @@ -289,10 +290,10 @@ impl<'a> StringReader<'a> { s: &'b str, errmsg: &'b str) -> Cow<'b, str> { let mut i = 0; while i < s.len() { - let ch = s.char_at(i); + let ch = char_at(s, i); let next = i + ch.len_utf8(); if ch == '\r' { - if next < s.len() && s.char_at(next) == '\n' { + if next < s.len() && char_at(s, next) == '\n' { return translate_crlf_(self, start, s, errmsg, i).into(); } let pos = start + BytePos(i as u32); @@ -308,12 +309,12 @@ impl<'a> StringReader<'a> { let mut buf = String::with_capacity(s.len()); let mut j = 0; while i < s.len() { - let ch = s.char_at(i); + let ch = char_at(s, i); let next = i + ch.len_utf8(); if ch == '\r' { if j < i { buf.push_str(&s[j..i]); } j = next; - if next >= s.len() || s.char_at(next) != '\n' { + if next >= s.len() || char_at(s, next) != '\n' { let pos = start + BytePos(i as u32); let end_pos = start + BytePos(next as u32); rdr.err_span_(pos, end_pos, errmsg); @@ -335,7 +336,7 @@ impl<'a> StringReader<'a> { if current_byte_offset < self.source_text.len() { assert!(self.curr.is_some()); let last_char = self.curr.unwrap(); - let ch = self.source_text.char_at(current_byte_offset); + let ch = char_at(&self.source_text, current_byte_offset); let next = current_byte_offset + ch.len_utf8(); let byte_offset_diff = next - current_byte_offset; self.pos = self.pos + Pos::from_usize(byte_offset_diff); @@ -357,7 +358,7 @@ impl<'a> StringReader<'a> { pub fn nextch(&self) -> Option { let offset = self.byte_offset(self.pos).to_usize(); if offset < self.source_text.len() { - Some(self.source_text.char_at(offset)) + Some(char_at(&self.source_text, offset)) } else { None } @@ -371,9 +372,9 @@ impl<'a> StringReader<'a> { let offset = self.byte_offset(self.pos).to_usize(); let s = &self.source_text[..]; if offset >= s.len() { return None } - let next = offset + s.char_at(offset).len_utf8(); + let next = offset + char_at(s, offset).len_utf8(); if next < s.len() { - Some(s.char_at(next)) + Some(char_at(s, next)) } else { None } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 51fb09a7526..1333e27058f 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -16,7 +16,7 @@ use diagnostic::{SpanHandler, mk_span_handler, default_handler, Auto, FatalError use parse::attr::ParserAttr; use parse::parser::Parser; use ptr::P; - +use str::char_at; use std::cell::{Cell, RefCell}; use std::fs::File; @@ -536,7 +536,7 @@ pub fn raw_str_lit(lit: &str) -> String { // check if `s` looks like i32 or u1234 etc. fn looks_like_width_suffix(first_chars: &[char], s: &str) -> bool { s.len() > 1 && - first_chars.contains(&s.char_at(0)) && + first_chars.contains(&char_at(s, 0)) && s[1..].chars().all(|c| '0' <= c && c <= '9') } @@ -673,8 +673,8 @@ pub fn integer_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) -> let orig = s; let mut ty = ast::UnsuffixedIntLit(ast::Plus); - if s.char_at(0) == '0' && s.len() > 1 { - match s.char_at(1) { + if char_at(s, 0) == '0' && s.len() > 1 { + match char_at(s, 1) { 'x' => base = 16, 'o' => base = 8, 'b' => base = 2, diff --git a/src/libsyntax/str.rs b/src/libsyntax/str.rs new file mode 100644 index 00000000000..d0f47629b10 --- /dev/null +++ b/src/libsyntax/str.rs @@ -0,0 +1,13 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn char_at(s: &str, byte: usize) -> char { + s[byte..].chars().next().unwrap() +} diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index c6646fe93a2..6adeb30a94e 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -15,6 +15,7 @@ use parse::new_parser_from_source_str; use parse::parser::Parser; use parse::token; use ptr::P; +use str::char_at; /// Map a string to tts, using a made-up filename: pub fn string_to_tts(source_str: String) -> Vec { @@ -96,24 +97,24 @@ pub fn matches_codepattern(a : &str, b : &str) -> bool { else if idx_a == a.len() {return false;} else if idx_b == b.len() { // maybe the stuff left in a is all ws? - if is_whitespace(a.char_at(idx_a)) { + if is_whitespace(char_at(a, idx_a)) { return scan_for_non_ws_or_end(a,idx_a) == a.len(); } else { return false; } } // ws in both given and pattern: - else if is_whitespace(a.char_at(idx_a)) - && is_whitespace(b.char_at(idx_b)) { + else if is_whitespace(char_at(a, idx_a)) + && is_whitespace(char_at(b, idx_b)) { idx_a = scan_for_non_ws_or_end(a,idx_a); idx_b = scan_for_non_ws_or_end(b,idx_b); } // ws in given only: - else if is_whitespace(a.char_at(idx_a)) { + else if is_whitespace(char_at(a, idx_a)) { idx_a = scan_for_non_ws_or_end(a,idx_a); } // *don't* silently eat ws in expected only. - else if a.char_at(idx_a) == b.char_at(idx_b) { + else if char_at(a, idx_a) == char_at(b, idx_b) { idx_a += 1; idx_b += 1; } @@ -129,7 +130,7 @@ pub fn matches_codepattern(a : &str, b : &str) -> bool { fn scan_for_non_ws_or_end(a : &str, idx: usize) -> usize { let mut i = idx; let len = a.len(); - while (i < len) && (is_whitespace(a.char_at(i))) { + while (i < len) && (is_whitespace(char_at(a, i))) { i += 1; } i -- cgit 1.4.1-3-g733a5