diff --git a/ast.rs b/ast.rs index 8f82a5f4..b180a296 100644 --- a/ast.rs +++ b/ast.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::fmt; -use std::vec; +use std::slice; #[deriving(Eq)] @@ -139,7 +139,7 @@ impl<'a> SkipWhitespaceIterable<'a> for &'a [ComponentValue] { #[deriving(Clone)] pub struct SkipWhitespaceIterator<'a> { - iter_with_whitespace: vec::Items<'a, ComponentValue>, + iter_with_whitespace: slice::Items<'a, ComponentValue>, } impl<'a> Iterator<&'a ComponentValue> for SkipWhitespaceIterator<'a> { @@ -163,7 +163,7 @@ impl MoveSkipWhitespaceIterable for ~[ComponentValue] { } pub struct MoveSkipWhitespaceIterator { - iter_with_whitespace: vec::MoveItems, + iter_with_whitespace: slice::MoveItems, } impl Iterator for MoveSkipWhitespaceIterator { diff --git a/color.rs b/color.rs index b79160a7..7338a6ac 100644 --- a/color.rs +++ b/color.rs @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::ascii::StrAsciiExt; -use std::cmp; use ast::*; @@ -298,9 +297,9 @@ fn parse_color_function(name: &str, arguments: &[ComponentValue]) let hue = expect_number!() / 360.; let hue = hue - hue.floor(); expect_comma!(); - let saturation = cmp::min(cmp::max((expect_percentage!() / 100.), 0.), 1.); + let saturation = (expect_percentage!() / 100.).min(0.).max(1.); expect_comma!(); - let lightness = cmp::min(cmp::max((expect_percentage!() / 100.), 0.), 1.); + let lightness = (expect_percentage!() / 100.).min(0.).max(1.); // http://www.w3.org/TR/css3-color/#hsl-color fn hue_to_rgb(m1: f64, m2: f64, mut h: f64) -> f64 { @@ -322,7 +321,7 @@ fn parse_color_function(name: &str, arguments: &[ComponentValue]) let alpha = if has_alpha { expect_comma!(); - cmp::min(cmp::max((expect_number!()), 0.), 1.) as f32 + (expect_number!()).min(0.).max(1.) as f32 } else { 1. }; diff --git a/lib.rs b/lib.rs index 0bcb783f..157b66b8 100644 --- a/lib.rs +++ b/lib.rs @@ -5,7 +5,6 @@ #[crate_id = "github.com/mozilla-servo/rust-cssparser#cssparser:0.1"]; #[feature(globs, macro_rules)]; -extern crate extra; extern crate encoding; // https://github.com/lifthrasiir/rust-encoding #[cfg(test)]