From 661d234c3c8662423ee12e248c30e7d0e1dae78a Mon Sep 17 00:00:00 2001 From: janczer Date: Wed, 7 Feb 2018 09:18:59 +0100 Subject: [PATCH] Change debug assertions to specific ones --- components/compositing/touch.rs | 2 +- components/hashglobe/src/hash_map.rs | 4 +-- components/layout/block.rs | 4 +-- .../layout/display_list/webrender_helpers.rs | 2 +- components/layout/fragment.rs | 2 +- components/layout/inline.rs | 2 +- components/layout/table.rs | 6 ++-- components/net/http_loader.rs | 2 +- components/script/dom/characterdata.rs | 2 +- components/script/dom/node.rs | 2 +- components/script/dom/webgltexture.rs | 2 +- components/servo_arc/lib.rs | 2 +- components/style/context.rs | 8 +++--- components/style/gecko/media_queries.rs | 14 +++++----- .../gecko_bindings/sugar/ns_style_coord.rs | 6 ++-- components/style/properties/gecko.mako.rs | 28 +++++++++---------- components/style/properties/helpers.mako.rs | 2 +- components/style/rule_tree/mod.rs | 6 ++-- components/style/stylist.rs | 2 +- components/style/values/computed/text.rs | 2 +- components/style/values/specified/color.rs | 2 +- ports/geckolib/glue.rs | 2 +- support/gecko/nsstring/src/lib.rs | 2 +- 23 files changed, 53 insertions(+), 53 deletions(-) diff --git a/components/compositing/touch.rs b/components/compositing/touch.rs index 020afb8a28b..fd4877ead75 100644 --- a/components/compositing/touch.rs +++ b/components/compositing/touch.rs @@ -219,7 +219,7 @@ impl TouchHandler { } fn pinch_distance_and_center(&self) -> (f32, TypedPoint2D) { - debug_assert!(self.touch_count() == 2); + debug_assert_eq!(self.touch_count(), 2); let p0 = self.active_touch_points[0].point; let p1 = self.active_touch_points[1].point; let center = p0.lerp(p1, 0.5); diff --git a/components/hashglobe/src/hash_map.rs b/components/hashglobe/src/hash_map.rs index 7622c284f99..27077526b3a 100644 --- a/components/hashglobe/src/hash_map.rs +++ b/components/hashglobe/src/hash_map.rs @@ -499,7 +499,7 @@ fn robin_hood<'a, K: 'a, V: 'a>(bucket: FullBucketMut<'a, K, V>, loop { displacement += 1; let probe = bucket.next(); - debug_assert!(probe.index() != idx_end); + debug_assert_ne!(probe.index(), idx_end); let full_bucket = match probe.peek() { Empty(bucket) => { @@ -578,7 +578,7 @@ impl HashMap Full(b) => b.into_bucket(), }; buckets.next(); - debug_assert!(buckets.index() != start_index); + debug_assert_ne!(buckets.index(), start_index); } } } diff --git a/components/layout/block.rs b/components/layout/block.rs index 7a846f50485..f87c837daf2 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -485,7 +485,7 @@ pub enum MarginsMayCollapseFlag { MarginsMayNotCollapse, } -#[derive(PartialEq)] +#[derive(Debug, PartialEq)] pub enum FormattingContextType { None, Block, @@ -1472,7 +1472,7 @@ impl BlockFlow { fn assign_inline_position_for_formatting_context(&mut self, layout_context: &LayoutContext, content_box: LogicalRect) { - debug_assert!(self.formatting_context_type() != FormattingContextType::None); + debug_assert_ne!(self.formatting_context_type(), FormattingContextType::None); if !self.base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW) { return diff --git a/components/layout/display_list/webrender_helpers.rs b/components/layout/display_list/webrender_helpers.rs index 31147bf4199..3fa80190a9e 100644 --- a/components/layout/display_list/webrender_helpers.rs +++ b/components/layout/display_list/webrender_helpers.rs @@ -269,7 +269,7 @@ impl WebRenderDisplayItemConverter for DisplayItem { }, DisplayItem::PushStackingContext(ref item) => { let stacking_context = &item.stacking_context; - debug_assert!(stacking_context.context_type == StackingContextType::Real); + debug_assert_eq!(stacking_context.context_type, StackingContextType::Real); let transform = stacking_context .transform diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 4de15fdbb32..39077f7963b 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -767,7 +767,7 @@ impl Fragment { let ellipsis_fragments = with_thread_local_font_context(layout_context, |font_context| { TextRunScanner::new().scan_for_runs(font_context, unscanned_ellipsis_fragments) }); - debug_assert!(ellipsis_fragments.len() == 1); + debug_assert_eq!(ellipsis_fragments.len(), 1); ellipsis_fragment = ellipsis_fragments.fragments.into_iter().next().unwrap(); ellipsis_fragment.flags |= FragmentFlags::IS_ELLIPSIS; ellipsis_fragment diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 2c9c37d204e..cc4581719d7 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -804,7 +804,7 @@ impl LineBreaker { self.work_list.push_front(cur_fragment); for fragment_index in (last_known_line_breaking_opportunity.get().. self.pending_line.range.end().get()).rev() { - debug_assert!(fragment_index == (self.new_fragments.len() as isize) - 1); + debug_assert_eq!(fragment_index, (self.new_fragments.len() as isize) - 1); self.work_list.push_front(self.new_fragments.pop().unwrap()); } diff --git a/components/layout/table.rs b/components/layout/table.rs index 8dd2443ae09..5068827c0d7 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -125,7 +125,7 @@ impl TableFlow { } } else { // We discovered a new column. Initialize its data. - debug_assert!(column_index == parent_inline_sizes.len()); + debug_assert_eq!(column_index, parent_inline_sizes.len()); if child_cell_inline_size.column_span > 1 { // TODO(pcwalton): Perform the recursive algorithm specified in INTRINSIC ยง // 4. For now we make this column contribute no width. @@ -635,7 +635,7 @@ impl VecExt for Vec { if index < self.len() { self[index] = value } else { - debug_assert!(index == self.len()); + debug_assert_eq!(index, self.len()); self.push(value) } &mut self[index] @@ -643,7 +643,7 @@ impl VecExt for Vec { fn get_mut_or_push(&mut self, index: usize, zero: T) -> &mut T { if index >= self.len() { - debug_assert!(index == self.len()); + debug_assert_eq!(index, self.len()); self.push(zero) } &mut self[index] diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 74cf5e4a30f..ea9e1b129d9 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -771,7 +771,7 @@ fn http_network_or_cache_fetch(request: &mut Request, // Step 11 if cors_flag || (http_request.method != Method::Get && http_request.method != Method::Head) { - debug_assert!(http_request.origin != Origin::Client); + debug_assert_ne!(http_request.origin, Origin::Client); if let Origin::Origin(ref url_origin) = http_request.origin { if let Some(hyper_origin) = try_immutable_origin_to_hyper_origin(url_origin) { http_request.headers.set(hyper_origin) diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs index 1222084edd5..ade3060ceb0 100644 --- a/components/script/dom/characterdata.rs +++ b/components/script/dom/characterdata.rs @@ -291,7 +291,7 @@ fn split_at_utf16_code_unit_offset(s: &str, offset: u32) -> Result<(&str, Option if c > '\u{FFFF}' { if code_units == offset { if opts::get().replace_surrogates { - debug_assert!(c.len_utf8() == 4); + debug_assert_eq!(c.len_utf8(), 4); return Ok((&s[..i], Some(c), &s[i + c.len_utf8()..])) } panic!("\n\n\ diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 68e6f63e168..ce97cb1ee4b 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1334,7 +1334,7 @@ impl TreeIterator { } self.depth -= 1; } - debug_assert!(self.depth == 0); + debug_assert_eq!(self.depth, 0); self.current = None; Some(current) } diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index 1336718eb00..ef980c75211 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -313,7 +313,7 @@ impl WebGLTexture { } fn is_cube_complete(&self) -> bool { - debug_assert!(self.face_count.get() == 6); + debug_assert_eq!(self.face_count.get(), 6); let image_info = self.base_image_info().unwrap(); if !image_info.is_defined() { diff --git a/components/servo_arc/lib.rs b/components/servo_arc/lib.rs index eff21f01019..0189e214f3b 100644 --- a/components/servo_arc/lib.rs +++ b/components/servo_arc/lib.rs @@ -598,7 +598,7 @@ impl Arc> { assert!(items.next().is_none(), "ExactSizeIterator under-reported length"); // We should have consumed the buffer exactly. - debug_assert!(current as *mut u8 == buffer.offset(size as isize)); + debug_assert_eq!(current as *mut u8, buffer.offset(size as isize)); } // Return the fat Arc. diff --git a/components/style/context.rs b/components/style/context.rs index 3768289da0e..b173aad03eb 100644 --- a/components/style/context.rs +++ b/components/style/context.rs @@ -472,7 +472,7 @@ impl SequentialTask { /// Executes this task. pub fn execute(self) { use self::SequentialTask::*; - debug_assert!(thread_state::get() == ThreadState::LAYOUT); + debug_assert_eq!(thread_state::get(), ThreadState::LAYOUT); match self { Unused(_) => unreachable!(), #[cfg(feature = "gecko")] @@ -560,7 +560,7 @@ impl SelectorFlagsMap { /// Applies the flags. Must be called on the main thread. fn apply_flags(&mut self) { - debug_assert!(thread_state::get() == ThreadState::LAYOUT); + debug_assert_eq!(thread_state::get(), ThreadState::LAYOUT); self.cache.evict_all(); for (el, flags) in self.map.drain() { unsafe { el.set_selector_flags(flags); } @@ -598,7 +598,7 @@ where E: TElement, { fn drop(&mut self) { - debug_assert!(thread_state::get() == ThreadState::LAYOUT); + debug_assert_eq!(thread_state::get(), ThreadState::LAYOUT); for task in self.0.drain(..) { task.execute() } @@ -751,7 +751,7 @@ impl ThreadLocalStyleContext { impl Drop for ThreadLocalStyleContext { fn drop(&mut self) { - debug_assert!(thread_state::get() == ThreadState::LAYOUT); + debug_assert_eq!(thread_state::get(), ThreadState::LAYOUT); // Apply any slow selector flags that need to be set on parents. self.selector_flags.apply_flags(); diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs index af738ad4f9c..94dc9271c3f 100644 --- a/components/style/gecko/media_queries.rs +++ b/components/style/gecko/media_queries.rs @@ -369,7 +369,7 @@ impl MediaExpressionValue { match for_expr.feature.mValueType { nsMediaFeature_ValueType::eLength => { - debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Pixel); + debug_assert_eq!(css_value.mUnit, nsCSSUnit::eCSSUnit_Pixel); let pixels = css_value.float_unchecked(); Some(MediaExpressionValue::Length(Length::from_px(pixels))) } @@ -379,17 +379,17 @@ impl MediaExpressionValue { Some(MediaExpressionValue::Integer(i as u32)) } nsMediaFeature_ValueType::eFloat => { - debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Number); + debug_assert_eq!(css_value.mUnit, nsCSSUnit::eCSSUnit_Number); Some(MediaExpressionValue::Float(css_value.float_unchecked())) } nsMediaFeature_ValueType::eBoolInteger => { - debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Integer); + debug_assert_eq!(css_value.mUnit, nsCSSUnit::eCSSUnit_Integer); let i = css_value.integer_unchecked(); debug_assert!(i == 0 || i == 1); Some(MediaExpressionValue::BoolInteger(i == 1)) } nsMediaFeature_ValueType::eResolution => { - debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Pixel); + debug_assert_eq!(css_value.mUnit, nsCSSUnit::eCSSUnit_Pixel); Some(MediaExpressionValue::Resolution(Resolution::Dppx(css_value.float_unchecked()))) } nsMediaFeature_ValueType::eEnumerated => { @@ -397,7 +397,7 @@ impl MediaExpressionValue { Some(MediaExpressionValue::Enumerated(value)) } nsMediaFeature_ValueType::eIdent => { - debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Ident); + debug_assert_eq!(css_value.mUnit, nsCSSUnit::eCSSUnit_Ident); let string = unsafe { let buffer = *css_value.mValue.mString.as_ref(); debug_assert!(!buffer.is_null()); @@ -774,11 +774,11 @@ impl Expression { one.to_dpi().partial_cmp(&actual_dpi).unwrap() } (&Ident(ref one), &Ident(ref other)) => { - debug_assert!(self.feature.mRangeType != nsMediaFeature_RangeType::eMinMaxAllowed); + debug_assert_ne!(self.feature.mRangeType, nsMediaFeature_RangeType::eMinMaxAllowed); return one == other; } (&Enumerated(one), &Enumerated(other)) => { - debug_assert!(self.feature.mRangeType != nsMediaFeature_RangeType::eMinMaxAllowed); + debug_assert_ne!(self.feature.mRangeType, nsMediaFeature_RangeType::eMinMaxAllowed); return one == other; } _ => unreachable!(), diff --git a/components/style/gecko_bindings/sugar/ns_style_coord.rs b/components/style/gecko_bindings/sugar/ns_style_coord.rs index abd53037c47..d08ad0e8669 100644 --- a/components/style/gecko_bindings/sugar/ns_style_coord.rs +++ b/components/style/gecko_bindings/sugar/ns_style_coord.rs @@ -378,7 +378,7 @@ pub unsafe trait CoordDataMut : CoordData { /// Gets the `Calc` value mutably, asserts in debug builds if the unit is /// not `Calc`. unsafe fn as_calc_mut(&mut self) -> &mut nsStyleCoord_Calc { - debug_assert!(self.unit() == nsStyleUnit::eStyleUnit_Calc); + debug_assert_eq!(self.unit(), nsStyleUnit::eStyleUnit_Calc); &mut *(*self.union().mPointer.as_mut() as *mut nsStyleCoord_Calc) } @@ -451,7 +451,7 @@ pub unsafe trait CoordData { /// Pretend inner value is a calc; obtain it. /// Ensure that the unit is Calc before calling this. unsafe fn get_calc_value(&self) -> nsStyleCoord_CalcValue { - debug_assert!(self.unit() == nsStyleUnit::eStyleUnit_Calc); + debug_assert_eq!(self.unit(), nsStyleUnit::eStyleUnit_Calc); (*self.as_calc())._base } @@ -459,7 +459,7 @@ pub unsafe trait CoordData { #[inline] /// Pretend the inner value is a calc expression, and obtain it. unsafe fn as_calc(&self) -> &nsStyleCoord_Calc { - debug_assert!(self.unit() == nsStyleUnit::eStyleUnit_Calc); + debug_assert_eq!(self.unit(), nsStyleUnit::eStyleUnit_Calc); &*(*self.union().mPointer.as_ref() as *const nsStyleCoord_Calc) } } diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 5b68b1eae1b..5b35784fc35 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -1213,7 +1213,7 @@ fn clone_single_transform_function( let convert_shared_list_to_operations = |value: &structs::nsCSSValue| -> Vec { - debug_assert!(value.mUnit == structs::nsCSSUnit::eCSSUnit_SharedList); + debug_assert_eq!(value.mUnit, structs::nsCSSUnit::eCSSUnit_SharedList); let value_list = unsafe { value.mValue.mSharedList.as_ref() .as_mut().expect("List pointer should be non-null").mHead.as_ref() @@ -1804,7 +1804,7 @@ fn static_assert() { use gecko_bindings::structs::nsStyleUnit; // z-index is never a calc(). If it were, we'd be leaking here, so // assert that it isn't. - debug_assert!(self.gecko.mZIndex.unit() != nsStyleUnit::eStyleUnit_Calc); + debug_assert_ne!(self.gecko.mZIndex.unit(), nsStyleUnit::eStyleUnit_Calc); unsafe { self.gecko.mZIndex.copy_from_unchecked(&other.gecko.mZIndex); } @@ -1837,7 +1837,7 @@ fn static_assert() { } pub fn set_computed_justify_items(&mut self, v: values::specified::JustifyItems) { - debug_assert!(v.0 != ::values::specified::align::AlignFlags::AUTO); + debug_assert_ne!(v.0, ::values::specified::align::AlignFlags::AUTO); self.gecko.mJustifyItems = v.into(); } @@ -2885,7 +2885,7 @@ fn static_assert() { I::IntoIter: ExactSizeIterator + Clone { let v = v.into_iter(); - debug_assert!(v.len() != 0); + debug_assert_ne!(v.len(), 0); let input_len = v.len(); self.gecko.m${type.capitalize()}s.ensure_len(input_len); @@ -2910,7 +2910,7 @@ fn static_assert() { I::IntoIter: ExactSizeIterator + Clone { let v = v.into_iter(); - debug_assert!(v.len() != 0); + debug_assert_ne!(v.len(), 0); let input_len = v.len(); self.gecko.m${type.capitalize()}s.ensure_len(input_len); @@ -2966,7 +2966,7 @@ fn static_assert() { let v = v.into_iter(); - debug_assert!(v.len() != 0); + debug_assert_ne!(v.len(), 0); let input_len = v.len(); self.gecko.mAnimations.ensure_len(input_len); @@ -3364,7 +3364,7 @@ fn static_assert() { I::IntoIter: ExactSizeIterator { let v = v.into_iter(); - debug_assert!(v.len() != 0); + debug_assert_ne!(v.len(), 0); self.gecko.mAnimations.ensure_len(v.len()); self.gecko.mAnimationNameCount = v.len() as u32; @@ -3957,7 +3957,7 @@ fn static_assert() { if ty == DimensionType::eAuto as u8 { LengthOrPercentageOrAuto::Auto } else { - debug_assert!(ty == DimensionType::eLengthPercentage as u8); + debug_assert_eq!(ty, DimensionType::eLengthPercentage as u8); value.into() } } @@ -3965,11 +3965,11 @@ fn static_assert() { longhands::background_size::computed_value::T( self.gecko.${image_layers_field}.mLayers.iter().map(|ref layer| { if DimensionType::eCover as u8 == layer.mSize.mWidthType { - debug_assert!(layer.mSize.mHeightType == DimensionType::eCover as u8); + debug_assert_eq!(layer.mSize.mHeightType, DimensionType::eCover as u8); return BackgroundSize::Cover } if DimensionType::eContain as u8 == layer.mSize.mWidthType { - debug_assert!(layer.mSize.mHeightType == DimensionType::eContain as u8); + debug_assert_eq!(layer.mSize.mHeightType, DimensionType::eContain as u8); return BackgroundSize::Contain } BackgroundSize::Explicit { @@ -4368,28 +4368,28 @@ fn static_assert() { ClipRectOrAuto::auto() } else { let left = if self.gecko.mClipFlags & NS_STYLE_CLIP_LEFT_AUTO as u8 != 0 { - debug_assert!(self.gecko.mClip.x == 0); + debug_assert_eq!(self.gecko.mClip.x, 0); None } else { Some(Au(self.gecko.mClip.x).into()) }; let top = if self.gecko.mClipFlags & NS_STYLE_CLIP_TOP_AUTO as u8 != 0 { - debug_assert!(self.gecko.mClip.y == 0); + debug_assert_eq!(self.gecko.mClip.y, 0); None } else { Some(Au(self.gecko.mClip.y).into()) }; let bottom = if self.gecko.mClipFlags & NS_STYLE_CLIP_BOTTOM_AUTO as u8 != 0 { - debug_assert!(self.gecko.mClip.height == 1 << 30); // NS_MAXSIZE + debug_assert_eq!(self.gecko.mClip.height, 1 << 30); // NS_MAXSIZE None } else { Some(Au(self.gecko.mClip.y + self.gecko.mClip.height).into()) }; let right = if self.gecko.mClipFlags & NS_STYLE_CLIP_RIGHT_AUTO as u8 != 0 { - debug_assert!(self.gecko.mClip.width == 1 << 30); // NS_MAXSIZE + debug_assert_eq!(self.gecko.mClip.width, 1 << 30); // NS_MAXSIZE None } else { Some(Au(self.gecko.mClip.x + self.gecko.mClip.width).into()) diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index cfb7fbbfa45..1b158832de9 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -303,7 +303,7 @@ DeclaredValue::Value(value) }, PropertyDeclaration::CSSWideKeyword(ref declaration) => { - debug_assert!(declaration.id == LonghandId::${property.camel_case}); + debug_assert_eq!(declaration.id, LonghandId::${property.camel_case}); DeclaredValue::CSSWideKeyword(declaration.keyword) }, PropertyDeclaration::WithVariables(..) => { diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs index 2a137d7eb79..9c710f07c5f 100644 --- a/components/style/rule_tree/mod.rs +++ b/components/style/rule_tree/mod.rs @@ -55,7 +55,7 @@ impl Drop for RuleTree { unsafe { self.gc(); } // After the GC, the free list should be empty. - debug_assert!(self.root.get().next_free.load(Ordering::Relaxed) == FREE_LIST_SENTINEL); + debug_assert_eq!(self.root.get().next_free.load(Ordering::Relaxed), FREE_LIST_SENTINEL); // Remove the sentinel. This indicates that GCs will no longer occur. // Any further drops of StrongRuleNodes must occur on the main thread, @@ -846,7 +846,7 @@ malloc_size_of_is_0!(StrongRuleNode); impl StrongRuleNode { fn new(n: Box) -> Self { - debug_assert!(n.parent.is_none() == !n.source.is_some()); + debug_assert_eq!(n.parent.is_none(), !n.source.is_some()); let ptr = Box::into_raw(n); log_new(ptr); @@ -1074,7 +1074,7 @@ impl StrongRuleNode { me.free_count().store(0, Ordering::Relaxed); - debug_assert!(me.next_free.load(Ordering::Relaxed) == FREE_LIST_SENTINEL); + debug_assert_eq!(me.next_free.load(Ordering::Relaxed), FREE_LIST_SENTINEL); } unsafe fn maybe_gc(&self) { diff --git a/components/style/stylist.rs b/components/style/stylist.rs index 4abe0aca207..dbbef4c4a6e 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -998,7 +998,7 @@ impl Stylist { // Gecko calls this from sequential mode, so we can directly apply // the flags. - debug_assert!(thread_state::get() == ThreadState::LAYOUT); + debug_assert_eq!(thread_state::get(), ThreadState::LAYOUT); let self_flags = flags.for_self(); if !self_flags.is_empty() { unsafe { element.set_selector_flags(self_flags); } diff --git a/components/style/values/computed/text.rs b/components/style/values/computed/text.rs index 123f735d513..bd97bd780d4 100644 --- a/components/style/values/computed/text.rs +++ b/components/style/values/computed/text.rs @@ -71,7 +71,7 @@ impl ToCss for TextOverflow { W: Write, { if self.sides_are_logical { - debug_assert!(self.first == TextOverflowSide::Clip); + debug_assert_eq!(self.first, TextOverflowSide::Clip); self.second.to_css(dest)?; } else { self.first.to_css(dest)?; diff --git a/components/style/values/specified/color.rs b/components/style/values/specified/color.rs index b7dbe35a165..c0799ceb318 100644 --- a/components/style/values/specified/color.rs +++ b/components/style/values/specified/color.rs @@ -315,7 +315,7 @@ impl Color { if let Some(unit) = unit { written += (&mut serialization[written..]).write(unit.as_bytes()).unwrap(); } - debug_assert!(written == 6); + debug_assert_eq!(written, 6); parse_hash_color(&serialization).map_err(|()| { location.new_custom_error(StyleParseErrorKind::UnspecifiedError) }) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 224f3a3798e..4092d1e2248 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -4171,7 +4171,7 @@ pub extern "C" fn Servo_StyleSet_GetFontFaceRules( rules: RawGeckoFontFaceRuleListBorrowedMut, ) { let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); - debug_assert!(rules.len() == 0); + debug_assert_eq!(rules.len(), 0); let global_style_data = &*GLOBAL_STYLE_DATA; let guard = global_style_data.shared_lock.read(); diff --git a/support/gecko/nsstring/src/lib.rs b/support/gecko/nsstring/src/lib.rs index d5c5f147c48..1d43db4ad7e 100644 --- a/support/gecko/nsstring/src/lib.rs +++ b/support/gecko/nsstring/src/lib.rs @@ -387,7 +387,7 @@ macro_rules! define_string_types { // data. let this: &$StringRepr = mem::transmute(self); if this.data.is_null() { - debug_assert!(this.length == 0); + debug_assert_eq!(this.length, 0); // Use an arbitrary non-null value as the pointer slice::from_raw_parts(0x1 as *const $char_t, 0) } else {