Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev.

This commit is contained in:
Ms2ger 2015-03-11 11:08:57 +01:00 committed by Josh Matthews
parent 65d4b12bf2
commit 5f15eb5fbf
140 changed files with 1420 additions and 1222 deletions

View file

@ -35,25 +35,11 @@ pub fn null_str_as_empty_ref<'a>(s: &'a Option<DOMString>) -> &'a str {
}
/// Whitespace as defined by HTML5 § 2.4.1.
struct Whitespace;
impl CharEq for Whitespace {
#[inline]
fn matches(&mut self, ch: char) -> bool {
match ch {
' ' | '\t' | '\x0a' | '\x0c' | '\x0d' => true,
_ => false,
}
}
#[inline]
fn only_ascii(&self) -> bool {
true
}
}
// TODO(SimonSapin) Maybe a custom Pattern can be more efficient?
const WHITESPACE: &'static [char] = &[' ', '\t', '\x0a', '\x0c', '\x0d'];
pub fn is_whitespace(s: &str) -> bool {
s.chars().all(|c| Whitespace.matches(c))
s.chars().all(|c| WHITESPACE.contains(&c))
}
/// A "space character" according to:
@ -144,7 +130,7 @@ pub enum LengthOrPercentageOrAuto {
/// Parses a length per HTML5 § 2.4.4.4. If unparseable, `Auto` is returned.
pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto {
value = value.trim_left_matches(Whitespace);
value = value.trim_left_matches(WHITESPACE);
if value.len() == 0 {
return LengthOrPercentageOrAuto::Auto
}
@ -200,7 +186,7 @@ pub fn parse_legacy_color(mut input: &str) -> Result<RGBA,()> {
}
// Step 3.
input = input.trim_left_matches(Whitespace).trim_right_matches(Whitespace);
input = input.trim_matches(WHITESPACE);
// Step 4.
if input.eq_ignore_ascii_case("transparent") {