diff options
-rw-r--r-- | components/canvas/canvas_paint_task.rs | 2 | ||||
-rw-r--r-- | components/compositing/compositor.rs | 3 | ||||
-rw-r--r-- | components/gfx/display_list/mod.rs | 2 | ||||
-rw-r--r-- | components/gfx/font_cache_task.rs | 2 | ||||
-rw-r--r-- | components/gfx/font_context.rs | 2 | ||||
-rw-r--r-- | components/layout/construct.rs | 2 | ||||
-rw-r--r-- | components/layout/css/matching.rs | 4 | ||||
-rw-r--r-- | components/layout/flow.rs | 2 | ||||
-rw-r--r-- | components/net/image_cache_task.rs | 3 | ||||
-rw-r--r-- | components/net_traits/image/base.rs | 4 | ||||
-rw-r--r-- | components/plugins/lints/inheritance_integrity.rs | 2 | ||||
-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 | ||||
-rw-r--r-- | components/util/str.rs | 8 | ||||
-rw-r--r-- | components/util/vec.rs | 2 | ||||
-rw-r--r-- | ports/cef/string_multimap.rs | 4 |
20 files changed, 25 insertions, 29 deletions
diff --git a/components/canvas/canvas_paint_task.rs b/components/canvas/canvas_paint_task.rs index f5c4e6c1fc6..766a7f96915 100644 --- a/components/canvas/canvas_paint_task.rs +++ b/components/canvas/canvas_paint_task.rs @@ -710,7 +710,7 @@ fn write_image(draw_target: &DrawTarget, smoothing_enabled: bool, composition_op: CompositionOp, global_alpha: f32) { - if image_data.len() == 0 { + if image_data.is_empty() { return } let image_rect = Rect::new(Point2D::zero(), image_size); diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index d70956e906e..b885bcb5a82 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -1320,7 +1320,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { // Return unused tiles first, so that they can be reused by any new BufferRequests. self.cache_unused_buffers(unused_buffers); - if layers_and_requests.len() == 0 { + if layers_and_requests.is_empty() { return false; } @@ -1803,4 +1803,3 @@ pub enum CompositingReason { /// The window has been zoomed. Zoom, } - diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 2822b6908a2..fe72d926c0d 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -586,7 +586,7 @@ impl StackingContext { pub fn print(&self, mut indentation: String) { // We cover the case of an empty string. - if indentation.len() == 0 { + if indentation.is_empty() { indentation = "####".to_owned(); } diff --git a/components/gfx/font_cache_task.rs b/components/gfx/font_cache_task.rs index b82c70509c7..995428e21e6 100644 --- a/components/gfx/font_cache_task.rs +++ b/components/gfx/font_cache_task.rs @@ -190,7 +190,7 @@ impl FontCache { debug!("FontList: Found font family with name={}", &**family_name); let s = self.local_families.get_mut(family_name).unwrap(); - if s.templates.len() == 0 { + if s.templates.is_empty() { get_variations_for_family(family_name, |path| { s.add_template(Atom::from_slice(&path), None); }); diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index 718e64c7e91..7d2b1740393 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -222,7 +222,7 @@ impl FontContext { // If unable to create any of the specified fonts, create one from the // list of last resort fonts for this platform. - if fonts.len() == 0 { + if fonts.is_empty() { let mut cache_hit = false; for cached_font_entry in self.fallback_font_cache.iter() { let cached_font = cached_font_entry.font.borrow(); diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 0e57bd13d1a..e8a1167a4fc 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -707,7 +707,7 @@ impl<'a> FlowConstructor<'a> { style: &Arc<ComputedValues>) { // Fast path: If there is no text content, return immediately. let text_content = node.text_content(); - if text_content.len() == 0 { + if text_content.is_empty() { return } diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index 1a372a82905..62315fb26e2 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -571,8 +571,8 @@ impl<'ln> MatchMethods for LayoutNode<'ln> { &mut applicable_declarations.after); *shareable = applicable_declarations.normal_shareable && - applicable_declarations.before.len() == 0 && - applicable_declarations.after.len() == 0 + applicable_declarations.before.is_empty() && + applicable_declarations.after.is_empty() } unsafe fn share_style_if_possible(&self, diff --git a/components/layout/flow.rs b/components/layout/flow.rs index aaab4a2507a..d2843b7d021 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -1238,7 +1238,7 @@ impl<'a> ImmutableFlowUtils for &'a (Flow + 'a) { /// Returns true if this flow has no children. fn is_leaf(self) -> bool { - base(self).children.len() == 0 + base(self).children.is_empty() } /// Returns the number of children that this flow possesses. diff --git a/components/net/image_cache_task.rs b/components/net/image_cache_task.rs index 7c672b1e604..2055f9a34a7 100644 --- a/components/net/image_cache_task.rs +++ b/components/net/image_cache_task.rs @@ -182,7 +182,7 @@ impl ImageCache { // Can only exit when all pending loads are complete. if let Some(ref exit_sender) = exit_sender { - if self.pending_loads.len() == 0 { + if self.pending_loads.is_empty() { exit_sender.send(()).unwrap(); break; } @@ -388,4 +388,3 @@ pub fn new_image_cache_task(resource_task: ResourceTask) -> ImageCacheTask { ImageCacheTask::new(ipc_command_sender) } - diff --git a/components/net_traits/image/base.rs b/components/net_traits/image/base.rs index 1b639555864..1e04ec84878 100644 --- a/components/net_traits/image/base.rs +++ b/components/net_traits/image/base.rs @@ -44,7 +44,7 @@ fn byte_swap_and_premultiply(data: &mut [u8]) { } pub fn load_from_memory(buffer: &[u8]) -> Option<Image> { - if buffer.len() == 0 { + if buffer.is_empty() { return None; } @@ -120,5 +120,3 @@ fn is_gif(buffer: &[u8]) -> bool { _ => false } } - - diff --git a/components/plugins/lints/inheritance_integrity.rs b/components/plugins/lints/inheritance_integrity.rs index ce4e775a6cd..fbb0c0c65df 100644 --- a/components/plugins/lints/inheritance_integrity.rs +++ b/components/plugins/lints/inheritance_integrity.rs @@ -83,7 +83,7 @@ impl LintPass for InheritancePass { cx.sess().span_note(*span, "Bare DOM struct found here"); } } - } else if dom_spans.len() == 0 { + } else if dom_spans.is_empty() { cx.span_lint(INHERITANCE_INTEGRITY, cx.tcx.map.expect_item(id).span, "This DOM struct has no reflector or parent DOM struct"); } 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 }); 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') } diff --git a/components/util/vec.rs b/components/util/vec.rs index c660d26584a..dd96fa07a99 100644 --- a/components/util/vec.rs +++ b/components/util/vec.rs @@ -35,7 +35,7 @@ impl<T: Ord + PartialOrd + PartialEq> BinarySearchMethods<T> for [T] { impl<T> FullBinarySearchMethods<T> for [T] { fn binary_search_index_by<K,C:Comparator<K,T>>(&self, key: &K, cmp: C) -> Option<usize> { - if self.len() == 0 { + if self.is_empty() { return None; } diff --git a/ports/cef/string_multimap.rs b/ports/cef/string_multimap.rs index d8932cea31a..c1760c65d74 100644 --- a/ports/cef/string_multimap.rs +++ b/ports/cef/string_multimap.rs @@ -20,7 +20,7 @@ pub extern "C" fn cef_string_multimap_alloc() -> *mut cef_string_multimap_t { pub extern "C" fn cef_string_multimap_size(smm: *mut cef_string_multimap_t) -> c_int { unsafe { if smm.is_null() { return 0; } - // t1 : collections::btree::map::Values<'_, collections::string::String, collections::vec::Vec<*mut types::cef_string_utf16>>` + // t1 : collections::btree::map::Values<'_, collections::string::String, collections::vec::Vec<*mut types::cef_string_utf16>>` let t1 = (*smm).values(); // t2 : collections::btree::map::BTreeMap<collections::string::String, collections::vec::Vec<*mut types::cef_string_utf16>> let t2 : usize = t1.map(|val| (*val).len()).sum(); @@ -118,7 +118,7 @@ pub extern "C" fn cef_string_multimap_value(smm: *mut cef_string_multimap_t, ind pub extern "C" fn cef_string_multimap_clear(smm: *mut cef_string_multimap_t) { unsafe { if smm.is_null() { return; } - if (*smm).len() == 0 { return; } + if (*smm).is_empty() { return; } for (_, val) in (*smm).iter_mut() { while let Some(cs) = (*val).pop() { cef_string_userfree_utf16_free(cs); |