Skip to content

Upgrade for latest rust. #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.a
*.so
*.dylib
*.dSYM
*.dll
*.dummy
*-test
Expand Down
6 changes: 3 additions & 3 deletions color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -34,7 +34,7 @@ pub fn parse_color(component_value: &ComponentValue) -> Option<Color> {

#[inline]
fn parse_color_keyword(value: &str) -> Option<Color> {
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) }
Expand Down Expand Up @@ -82,7 +82,7 @@ fn parse_color_hash(value: &str) -> Option<Color> {
#[inline]
fn parse_color_function(name: &str, arguments: &[ComponentValue])
-> Option<Color> {
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) }
Expand Down
9 changes: 5 additions & 4 deletions nth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;


Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


use std::iterator::Iterator;
use std::ascii::eq_ignore_ascii_case;
use std::ascii::StrAsciiExt;

use ast::*;

Expand Down Expand Up @@ -244,7 +244,7 @@ fn parse_declaration_important<T: Iterator<Node>>(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,
Expand Down
4 changes: 2 additions & 2 deletions tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down Expand Up @@ -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)
Expand Down