Skip to content
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
6 changes: 3 additions & 3 deletions ast.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::fmt;
use std::vec;
use std::slice;


#[deriving(Eq)]
Expand Down Expand Up @@ -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> {
Expand All @@ -163,7 +163,7 @@ impl MoveSkipWhitespaceIterable for ~[ComponentValue] {
}

pub struct MoveSkipWhitespaceIterator {
iter_with_whitespace: vec::MoveItems<ComponentValue>,
iter_with_whitespace: slice::MoveItems<ComponentValue>,
}

impl Iterator<ComponentValue> for MoveSkipWhitespaceIterator {
Expand Down
7 changes: 3 additions & 4 deletions color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down Expand Up @@ -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 {
Expand All @@ -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.
};
Expand Down
1 change: 0 additions & 1 deletion lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down