diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-05-05 09:11:30 -0500 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-05-05 09:11:30 -0500 |
commit | 49aed6555dbc008c1a378c5cbb303f5467232b6b (patch) | |
tree | 9146cdd7126ead59c57cacbaa04eda0f16761f65 /components/util/str.rs | |
parent | 7b87085c1880c60aa3be5b3ec4572a0d93fd5537 (diff) | |
parent | ef8edd4e87aeb3cc71dfd9da2f69437080f5410e (diff) | |
download | servo-49aed6555dbc008c1a378c5cbb303f5467232b6b.tar.gz servo-49aed6555dbc008c1a378c5cbb303f5467232b6b.zip |
Auto merge of #5935 - servo:rustup_2015-04-25, r=Ms2ger
r? everybody
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5935)
<!-- Reviewable:end -->
Diffstat (limited to 'components/util/str.rs')
-rw-r--r-- | components/util/str.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/components/util/str.rs b/components/util/str.rs index 7c36aca7c18..afa4b85c24c 100644 --- a/components/util/str.rs +++ b/components/util/str.rs @@ -7,11 +7,11 @@ use geometry::Au; use cssparser::{self, RGBA, Color}; use libc::c_char; +use num_lib::ToPrimitive; use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::ffi::CStr; use std::iter::Filter; -use std::num::{Int, ToPrimitive}; use std::ops::Deref; use std::str::{from_utf8, FromStr, Split}; @@ -130,7 +130,7 @@ pub fn parse_unsigned_integer<T: Iterator<Item=char>>(input: T) -> Option<u32> { #[derive(Copy, Clone)] pub enum LengthOrPercentageOrAuto { Auto, - Percentage(f64), + Percentage(f32), Length(Au), } @@ -171,9 +171,9 @@ pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto { value = &value[..end_index]; if found_percent { - let result: Result<f64, _> = FromStr::from_str(value); + let result: Result<f32, _> = FromStr::from_str(value); match result { - Ok(number) => return LengthOrPercentageOrAuto::Percentage((number as f64) / 100.0), + Ok(number) => return LengthOrPercentageOrAuto::Percentage((number as f32) / 100.0), Err(_) => return LengthOrPercentageOrAuto::Auto, } } @@ -243,7 +243,7 @@ pub fn parse_legacy_color(mut input: &str) -> Result<RGBA,()> { } // Step 9. - if input.char_at(0) == '#' { + if input.as_bytes()[0] == b'#' { input = &input[1..] } @@ -324,7 +324,7 @@ pub struct LowercaseString { impl LowercaseString { pub fn new(s: &str) -> LowercaseString { LowercaseString { - inner: s.chars().map(|c| c.to_lowercase()).collect(), + inner: s.to_lowercase(), } } } |