From 9bc1d9bb205822c09c023a5ab52afc9453f95774 Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Thu, 15 Aug 2013 18:52:49 -0600 Subject: [PATCH 1/2] Update ignores. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 874904a8..6cf2809d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.a *.so *.dylib +*.dSYM *.dll *.dummy *-test From 4e5c369c93ce0e1ac2a773db03b2ee72cf07ba9b Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Thu, 15 Aug 2013 18:53:01 -0600 Subject: [PATCH 2/2] Upgrade for latest rust. --- color.rs | 6 +++--- nth.rs | 9 +++++---- parser.rs | 4 ++-- tokenizer.rs | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/color.rs b/color.rs index 356d82f8..b758aac0 100644 --- a/color.rs +++ b/color.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::libc::c_float; -use std::ascii::to_ascii_lower; +use std::ascii::StrAsciiExt; use ast::*; use self::color_data::{COLOR_KEYWORDS, COLOR_VALUES}; @@ -34,7 +34,7 @@ pub fn parse_color(component_value: &ComponentValue) -> Option { #[inline] fn parse_color_keyword(value: &str) -> Option { - let lower_value = to_ascii_lower(value); + let lower_value = value.to_ascii_lower(); match COLOR_KEYWORDS.bsearch_elem(&lower_value.as_slice()) { Some(index) => Some(COLOR_VALUES[index]), None => if "currentcolor" == lower_value { Some(CurrentColor) } @@ -82,7 +82,7 @@ fn parse_color_hash(value: &str) -> Option { #[inline] fn parse_color_function(name: &str, arguments: &[ComponentValue]) -> Option { - let lower_name = to_ascii_lower(name); + let lower_name = name.to_ascii_lower(); let (is_rgb, has_alpha) = if "rgba" == lower_name { (true, true) } diff --git a/nth.rs b/nth.rs index 0d3e4257..2b7286fc 100644 --- a/nth.rs +++ b/nth.rs @@ -3,7 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::i32; -use std::ascii::to_ascii_lower; +use std::ascii::StrAsciiExt; + use ast::*; @@ -19,7 +20,7 @@ pub fn parse_nth(input: &[ComponentValue]) -> Option<(i32, i32)> { }, Some(&Dimension(ref value, ref unit)) => match value.int_value { Some(a) => { - let unit: &str = to_ascii_lower(unit.as_slice()); + let unit: &str = unit.as_slice().to_ascii_lower(); match unit { "n" => parse_b(iter, a as i32), "n-" => parse_signless_b(iter, a as i32, -1), @@ -32,7 +33,7 @@ pub fn parse_nth(input: &[ComponentValue]) -> Option<(i32, i32)> { _ => None, }, Some(&Ident(ref value)) => { - let ident: &str = to_ascii_lower(value.as_slice()); + let ident: &str = value.as_slice().to_ascii_lower(); match ident { "even" => parse_end(iter, 2, 0), "odd" => parse_end(iter, 2, 1), @@ -52,7 +53,7 @@ pub fn parse_nth(input: &[ComponentValue]) -> Option<(i32, i32)> { }, Some(&Delim('+')) => match iter.iter_with_whitespace.next() { Some(&Ident(ref value)) => { - let ident: &str = to_ascii_lower(value.as_slice()); + let ident: &str = value.as_slice().to_ascii_lower(); match ident { "n" => parse_b(iter, 1), "n-" => parse_signless_b(iter, 1, -1), diff --git a/parser.rs b/parser.rs index 38538da4..d53b5d3a 100644 --- a/parser.rs +++ b/parser.rs @@ -15,7 +15,7 @@ use std::iterator::Iterator; -use std::ascii::eq_ignore_ascii_case; +use std::ascii::StrAsciiExt; use ast::*; @@ -244,7 +244,7 @@ fn parse_declaration_important>(iter: &mut T) -> bool { Some((Ident(value), _)) => value, _ => return false, }; - if !eq_ignore_ascii_case(ident_value, "important") { return false } + if !ident_value.eq_ignore_ascii_case("important") { return false } match next_non_whitespace(iter) { Some((Semicolon, _)) => true, None => true, diff --git a/tokenizer.rs b/tokenizer.rs index 7a61ee42..dca90643 100644 --- a/tokenizer.rs +++ b/tokenizer.rs @@ -5,7 +5,7 @@ // http://dev.w3.org/csswg/css3-syntax/#tokenization use std::{str, u32, i64, f64}; -use std::ascii::eq_ignore_ascii_case; +use std::ascii::StrAsciiExt; use ast::*; @@ -361,7 +361,7 @@ fn is_ident_start(tokenizer: &mut Tokenizer) -> bool { fn consume_ident_like(tokenizer: &mut Tokenizer) -> ComponentValue { let value = consume_name(tokenizer); if !tokenizer.is_eof() && tokenizer.current_char() == '(' { - if eq_ignore_ascii_case(value, "url") { consume_url(tokenizer) } + if value.eq_ignore_ascii_case("url") { consume_url(tokenizer) } else { Function(value, consume_block(tokenizer, CloseParenthesis)) } } else { Ident(value)