diff options
author | João Oliveira <hello@jxs.pt> | 2015-08-14 03:55:02 +0100 |
---|---|---|
committer | João Oliveira <hello@jxs.pt> | 2015-08-14 04:00:33 +0100 |
commit | 9c117818800b69f04f76e4f7afd92b2660752bae (patch) | |
tree | ba530ec7ba188dbca6d7e4fbe4422eea2b578537 /components/script | |
parent | f5e97ef1b54b7f85d9c5a55712e802dd70a89f8e (diff) | |
download | servo-9c117818800b69f04f76e4f7afd92b2660752bae.tar.gz servo-9c117818800b69f04f76e4f7afd92b2660752bae.zip |
replace .len() == 0 with is_empty()
closes #7198
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/cors.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/str.rs | 2 | ||||
-rw-r--r-- | components/script/dom/document.rs | 2 | ||||
-rw-r--r-- | components/script/dom/htmlscriptelement.rs | 2 | ||||
-rw-r--r-- | components/script/dom/node.rs | 2 | ||||
-rw-r--r-- | components/script/dom/xmlhttprequest.rs | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/components/script/cors.rs b/components/script/cors.rs index 744864abed9..f9170edc020 100644 --- a/components/script/cors.rs +++ b/components/script/cors.rs @@ -232,7 +232,7 @@ impl CORSRequest { _ => return error }; // Substep 4 - if methods.len() == 0 || preflight.mode == RequestMode::ForcedPreflight { + if methods.is_empty() || preflight.mode == RequestMode::ForcedPreflight { methods = &methods_substep4; } // Substep 5 diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs index 26a4b6149a9..6c7fea1dc10 100644 --- a/components/script/dom/bindings/str.rs +++ b/components/script/dom/bindings/str.rs @@ -50,7 +50,7 @@ impl ByteString { /// [RFC 2616](http://tools.ietf.org/html/rfc2616#page-17). pub fn is_token(&self) -> bool { let ByteString(ref vec) = *self; - if vec.len() == 0 { + if vec.is_empty() { return false; // A token must be at least a single character } vec.iter().all(|&x| { diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 394523daac7..9c7ea6d9085 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -970,7 +970,7 @@ impl<'a> DocumentHelpers<'a> for &'a Document { /// https://html.spec.whatwg.org/multipage/#dom-window-cancelanimationframe fn cancel_animation_frame(self, ident: i32) { self.animation_frame_list.borrow_mut().remove(&ident); - if self.animation_frame_list.borrow().len() == 0 { + if self.animation_frame_list.borrow().is_empty() { let window = self.window.root(); let window = window.r(); let ConstellationChan(ref chan) = window.constellation_chan(); diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 16b8933f450..47ba56af573 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -231,7 +231,7 @@ impl<'a> HTMLScriptElementHelpers for &'a HTMLScriptElement { } // Step 4. let text = self.Text(); - if text.len() == 0 && !element.has_attribute(&atom!("src")) { + if text.is_empty() && !element.has_attribute(&atom!("src")) { return NextParserState::Continue; } // Step 5. diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index df815ef6b9d..ac5b6ac3401 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -2135,7 +2135,7 @@ impl<'a> NodeMethods for &'a Node { NodeTypeId::DocumentFragment | NodeTypeId::Element(..) => { // Step 1-2. - let node = if value.len() == 0 { + let node = if value.is_empty() { None } else { let document = self.owner_doc(); diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index c7f975d54cd..739d5de6fba 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -497,7 +497,7 @@ impl<'a> XMLHttpRequestMethods for &'a XMLHttpRequest { // Step 7 self.upload_complete.set(match extracted { None => true, - Some (ref v) if v.len() == 0 => true, + Some (ref v) if v.is_empty() => true, _ => false }); |