aboutsummaryrefslogtreecommitdiffstats
path: root/components/util/str.rs
diff options
context:
space:
mode:
authorJoão Oliveira <hello@jxs.pt>2015-08-14 03:55:02 +0100
committerJoão Oliveira <hello@jxs.pt>2015-08-14 04:00:33 +0100
commit9c117818800b69f04f76e4f7afd92b2660752bae (patch)
treeba530ec7ba188dbca6d7e4fbe4422eea2b578537 /components/util/str.rs
parentf5e97ef1b54b7f85d9c5a55712e802dd70a89f8e (diff)
downloadservo-9c117818800b69f04f76e4f7afd92b2660752bae.tar.gz
servo-9c117818800b69f04f76e4f7afd92b2660752bae.zip
replace .len() == 0 with is_empty()
closes #7198
Diffstat (limited to 'components/util/str.rs')
-rw-r--r--components/util/str.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/components/util/str.rs b/components/util/str.rs
index af688a1103e..e0c9e2a2fad 100644
--- a/components/util/str.rs
+++ b/components/util/str.rs
@@ -121,14 +121,14 @@ 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);
- if value.len() == 0 {
+ if value.is_empty() {
return LengthOrPercentageOrAuto::Auto
}
if value.starts_with("+") {
value = &value[1..]
}
value = value.trim_left_matches('0');
- if value.len() == 0 {
+ if value.is_empty() {
return LengthOrPercentageOrAuto::Auto
}
@@ -171,7 +171,7 @@ pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto {
/// Parses a legacy color per HTML5 § 2.4.6. If unparseable, `Err` is returned.
pub fn parse_legacy_color(mut input: &str) -> Result<RGBA,()> {
// Steps 1 and 2.
- if input.len() == 0 {
+ if input.is_empty() {
return Err(())
}
@@ -243,7 +243,7 @@ pub fn parse_legacy_color(mut input: &str) -> Result<RGBA,()> {
let mut input = new_input;
// Step 11.
- while input.len() == 0 || (input.len() % 3) != 0 {
+ while input.is_empty() || (input.len() % 3) != 0 {
input.push(b'0')
}