diff --git a/components/style/counter_style/mod.rs b/components/style/counter_style/mod.rs index daad5145e1c..d968bf20d51 100644 --- a/components/style/counter_style/mod.rs +++ b/components/style/counter_style/mod.rs @@ -244,7 +244,7 @@ macro_rules! counter_style_descriptors { dest.write_str("; ")?; } )+ - dest.write_str("}") + dest.write_char('}') } } } diff --git a/components/style/font_face.rs b/components/style/font_face.rs index f1b4651c769..7ed545a1c4d 100644 --- a/components/style/font_face.rs +++ b/components/style/font_face.rs @@ -306,7 +306,7 @@ macro_rules! impl_range { { self.0.to_css(dest)?; if self.0 != self.1 { - dest.write_str(" ")?; + dest.write_char(' ')?; self.1.to_css(dest)?; } Ok(()) @@ -714,7 +714,7 @@ impl ToCssWithGuard for FontFaceRuleData { fn to_css(&self, _guard: &SharedRwLockReadGuard, dest: &mut CssStringWriter) -> fmt::Result { dest.write_str("@font-face { ")?; self.decl_to_css(dest)?; - dest.write_str("}") + dest.write_char('}') } } diff --git a/components/style/gecko_bindings/sugar/refptr.rs b/components/style/gecko_bindings/sugar/refptr.rs index d8c0cea0f2b..e2536018622 100644 --- a/components/style/gecko_bindings/sugar/refptr.rs +++ b/components/style/gecko_bindings/sugar/refptr.rs @@ -11,6 +11,7 @@ use servo_arc::Arc; use std::marker::PhantomData; use std::ops::{Deref, DerefMut}; use std::{fmt, mem, ptr}; +use std::fmt::Write; /// Trait for all objects that have Addref() and Release /// methods and can be placed inside RefPtr @@ -35,7 +36,7 @@ impl fmt::Debug for RefPtr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("RefPtr { ")?; self.ptr.fmt(f)?; - f.write_str("}") + f.write_char('}') } } diff --git a/components/style/invalidation/element/invalidator.rs b/components/style/invalidation/element/invalidator.rs index ac8f9ed5f81..db644d1a449 100644 --- a/components/style/invalidation/element/invalidator.rs +++ b/components/style/invalidation/element/invalidator.rs @@ -14,6 +14,7 @@ use selectors::parser::{Combinator, Component}; use selectors::OpaqueElement; use smallvec::SmallVec; use std::fmt; +use std::fmt::Write; /// A trait to abstract the collection of invalidations for a given pass. pub trait InvalidationProcessor<'a, E> @@ -257,7 +258,7 @@ impl<'a> fmt::Debug for Invalidation<'a> { } component.to_css(f)?; } - f.write_str(")") + f.write_char(')') } } diff --git a/components/style/piecewise_linear.rs b/components/style/piecewise_linear.rs index 9259a086bd2..84ccb7061c3 100644 --- a/components/style/piecewise_linear.rs +++ b/components/style/piecewise_linear.rs @@ -39,7 +39,7 @@ impl ToCss for PiecewiseLinearFunctionEntry { W: fmt::Write, { self.y.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; Percentage(self.x).to_css(dest) } } diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs index 01b390f0fca..204c874fc1c 100644 --- a/components/style/properties/declaration_block.rs +++ b/components/style/properties/declaration_block.rs @@ -1183,7 +1183,7 @@ where W: Write, { if !*is_first_serialization { - dest.write_str(" ") + dest.write_char(' ') } else { *is_first_serialization = false; Ok(()) diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index 4c051ab550f..2bf274d32cc 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -865,7 +865,7 @@ first.to_css(dest)?; if first != second { - dest.write_str(" ")?; + dest.write_char(' ')?; second.to_css(dest)?; } Ok(()) diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 5c052bec73f..2587bd1987c 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -134,10 +134,10 @@ pub mod shorthands { width.to_css(dest)?; // FIXME(emilio): Should we really serialize the border style if it's // `solid`? - dest.write_str(" ")?; + dest.write_char(' ')?; style.to_css(dest)?; if *color != Color::CurrentColor { - dest.write_str(" ")?; + dest.write_char(' ')?; color.to_css(dest)?; } Ok(()) diff --git a/components/style/properties/shorthands/background.mako.rs b/components/style/properties/shorthands/background.mako.rs index ff5edecff4d..5fee5cb2b03 100644 --- a/components/style/properties/shorthands/background.mako.rs +++ b/components/style/properties/shorthands/background.mako.rs @@ -167,7 +167,7 @@ if *image != background_image::single_value::get_initial_specified_value() { if wrote_value { - dest.write_str(" ")?; + dest.write_char(' ')?; } image.to_css(dest)?; wrote_value = true; @@ -180,7 +180,7 @@ *size != background_size::single_value::get_initial_specified_value() { if wrote_value { - dest.write_str(" ")?; + dest.write_char(' ')?; } Position { @@ -199,7 +199,7 @@ % for name in "repeat attachment".split(): if *${name} != background_${name}::single_value::get_initial_specified_value() { if wrote_value { - dest.write_str(" ")?; + dest.write_char(' ')?; } ${name}.to_css(dest)?; wrote_value = true; @@ -208,11 +208,11 @@ if *origin != Origin::PaddingBox || *clip != Clip::BorderBox { if wrote_value { - dest.write_str(" ")?; + dest.write_char(' ')?; } origin.to_css(dest)?; if *clip != From::from(*origin) { - dest.write_str(" ")?; + dest.write_char(' ')?; clip.to_css(dest)?; } diff --git a/components/style/properties/shorthands/border.mako.rs b/components/style/properties/shorthands/border.mako.rs index 217d1a451f3..95dca014a64 100644 --- a/components/style/properties/shorthands/border.mako.rs +++ b/components/style/properties/shorthands/border.mako.rs @@ -373,13 +373,13 @@ pub fn parse_border<'i, 't>( impl<'a> ToCss for LonghandsToSerialize<'a> { fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { self.border_image_source.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; self.border_image_slice.to_css(dest)?; dest.write_str(" / ")?; self.border_image_width.to_css(dest)?; dest.write_str(" / ")?; self.border_image_outset.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; self.border_image_repeat.to_css(dest) } } @@ -420,7 +420,7 @@ pub fn parse_border<'i, 't>( self.border_${axis}_start_${prop}.to_css(dest)?; if self.border_${axis}_end_${prop} != self.border_${axis}_start_${prop} { - dest.write_str(" ")?; + dest.write_char(' ')?; self.border_${axis}_end_${prop}.to_css(dest)?; } diff --git a/components/style/properties/shorthands/box.mako.rs b/components/style/properties/shorthands/box.mako.rs index 259febc7507..3d30250b07c 100644 --- a/components/style/properties/shorthands/box.mako.rs +++ b/components/style/properties/shorthands/box.mako.rs @@ -203,12 +203,12 @@ ${helpers.two_properties_shorthand( self.offset_path.to_css(dest)?; if !self.offset_distance.is_zero() { - dest.write_str(" ")?; + dest.write_char(' ')?; self.offset_distance.to_css(dest)?; } if !self.offset_rotate.is_auto() { - dest.write_str(" ")?; + dest.write_char(' ')?; self.offset_rotate.to_css(dest)?; } diff --git a/components/style/properties/shorthands/font.mako.rs b/components/style/properties/shorthands/font.mako.rs index 7b87125d065..e1c1c270a5e 100644 --- a/components/style/properties/shorthands/font.mako.rs +++ b/components/style/properties/shorthands/font.mako.rs @@ -227,13 +227,13 @@ % for name in "style variant_caps weight".split(): if self.font_${name} != &font_${name}::get_initial_specified_value() { self.font_${name}.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; } % endfor if font_stretch != FontStretchKeyword::Normal { font_stretch.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; } self.font_size.to_css(dest)?; @@ -243,7 +243,7 @@ self.line_height.to_css(dest)?; } - dest.write_str(" ")?; + dest.write_char(' ')?; self.font_family.to_css(dest)?; Ok(()) @@ -443,7 +443,7 @@ % endif if value != &font_variant_${prop}::get_initial_specified_value() { if has_any { - dest.write_str(" ")?; + dest.write_char(' ')?; } has_any = true; value.to_css(dest)?; diff --git a/components/style/properties/shorthands/list.mako.rs b/components/style/properties/shorthands/list.mako.rs index 2d508f22d9e..10a43f83f4c 100644 --- a/components/style/properties/shorthands/list.mako.rs +++ b/components/style/properties/shorthands/list.mako.rs @@ -120,7 +120,7 @@ } if self.list_style_image != &ListStyleImage::None { if have_one_non_initial_value { - dest.write_str(" ")?; + dest.write_char(' ')?; } self.list_style_image.to_css(dest)?; have_one_non_initial_value = true; @@ -131,7 +131,7 @@ let type_is_initial = self.list_style_type == &ListStyleType::Disc; if !type_is_initial { if have_one_non_initial_value { - dest.write_str(" ")?; + dest.write_char(' ')?; } self.list_style_type.to_css(dest)?; have_one_non_initial_value = true; diff --git a/components/style/properties/shorthands/position.mako.rs b/components/style/properties/shorthands/position.mako.rs index b5899593bfd..471e67c0986 100644 --- a/components/style/properties/shorthands/position.mako.rs +++ b/components/style/properties/shorthands/position.mako.rs @@ -138,7 +138,7 @@ self.row_gap.to_css(dest) } else { self.row_gap.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; self.column_gap.to_css(dest) } } @@ -497,7 +497,7 @@ .zip(&mut names_iter) .zip(track_list.values.iter()) { if i > 0 { - dest.write_str(" ")?; + dest.write_char(' ')?; } if !names.is_empty() { @@ -508,7 +508,7 @@ // If the track size is the initial value then it's redundant here. if !value.is_initial() { - dest.write_str(" ")?; + dest.write_char(' ')?; value.to_css(dest)?; } } @@ -665,7 +665,7 @@ } if !self.grid_auto_columns.is_initial() { - dest.write_str(" ")?; + dest.write_char(' ')?; self.grid_auto_columns.to_css(dest)?; } @@ -691,7 +691,7 @@ } if !self.grid_auto_rows.is_initial() { - dest.write_str(" ")?; + dest.write_char(' ')?; self.grid_auto_rows.to_css(dest)?; } @@ -749,7 +749,7 @@ fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { self.align_content.to_css(dest)?; if self.align_content.0 != self.justify_content.0 { - dest.write_str(" ")?; + dest.write_char(' ')?; self.justify_content.to_css(dest)?; } Ok(()) @@ -790,7 +790,7 @@ fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { self.align_self.to_css(dest)?; if self.align_self.0 != self.justify_self.0 { - dest.write_str(" ")?; + dest.write_char(' ')?; self.justify_self.to_css(dest)?; } Ok(()) @@ -832,7 +832,7 @@ fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { self.align_items.to_css(dest)?; if self.align_items.0 != self.justify_items.0 { - dest.write_str(" ")?; + dest.write_char(' ')?; self.justify_items.to_css(dest)?; } diff --git a/components/style/properties/shorthands/svg.mako.rs b/components/style/properties/shorthands/svg.mako.rs index 99461a51487..97cce9ad04d 100644 --- a/components/style/properties/shorthands/svg.mako.rs +++ b/components/style/properties/shorthands/svg.mako.rs @@ -150,7 +150,7 @@ image.to_css(dest)?; if *mode != mask_mode::single_value::get_initial_specified_value() { - dest.write_str(" ")?; + dest.write_char(' ')?; mode.to_css(dest)?; } @@ -158,7 +158,7 @@ *position_y != PositionComponent::zero() || *size != mask_size::single_value::get_initial_specified_value() { - dest.write_str(" ")?; + dest.write_char(' ')?; Position { horizontal: position_x.clone(), vertical: position_y.clone() @@ -171,21 +171,21 @@ } if *repeat != mask_repeat::single_value::get_initial_specified_value() { - dest.write_str(" ")?; + dest.write_char(' ')?; repeat.to_css(dest)?; } if *origin != Origin::BorderBox || *clip != Clip::BorderBox { - dest.write_str(" ")?; + dest.write_char(' ')?; origin.to_css(dest)?; if *clip != From::from(*origin) { - dest.write_str(" ")?; + dest.write_char(' ')?; clip.to_css(dest)?; } } if *composite != mask_composite::single_value::get_initial_specified_value() { - dest.write_str(" ")?; + dest.write_char(' ')?; composite.to_css(dest)?; } } diff --git a/components/style/properties/shorthands/text.mako.rs b/components/style/properties/shorthands/text.mako.rs index 074de01aef2..34d3cd5c5db 100644 --- a/components/style/properties/shorthands/text.mako.rs +++ b/components/style/properties/shorthands/text.mako.rs @@ -91,7 +91,7 @@ % if engine == "gecko": if !is_auto_thickness { if has_value { - dest.write_str(" ")?; + dest.write_char(' ')?; } self.text_decoration_thickness.to_css(dest)?; has_value = true; @@ -99,7 +99,7 @@ if !is_solid_style { if has_value { - dest.write_str(" ")?; + dest.write_char(' ')?; } self.text_decoration_style.to_css(dest)?; has_value = true; @@ -107,7 +107,7 @@ if !is_current_color { if has_value { - dest.write_str(" ")?; + dest.write_char(' ')?; } self.text_decoration_color.to_css(dest)?; has_value = true; diff --git a/components/style/properties/shorthands/ui.mako.rs b/components/style/properties/shorthands/ui.mako.rs index 4b99243b59c..b869db9c968 100644 --- a/components/style/properties/shorthands/ui.mako.rs +++ b/components/style/properties/shorthands/ui.mako.rs @@ -154,7 +154,7 @@ macro_rules! try_parse_one { self.transition_property.0[i].to_css(dest)?; } % for name in "duration timing_function delay".split(): - dest.write_str(" ")?; + dest.write_char(' ')?; self.transition_${name}.0[i].to_css(dest)?; % endfor } @@ -289,7 +289,7 @@ macro_rules! try_parse_one { % for name in props[2:]: self.animation_${name}.0[i].to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; % endfor self.animation_name.0[i].to_css(dest)?; diff --git a/components/style/queries/feature_expression.rs b/components/style/queries/feature_expression.rs index b4715c00739..ec0e7f5b113 100644 --- a/components/style/queries/feature_expression.rs +++ b/components/style/queries/feature_expression.rs @@ -263,7 +263,7 @@ impl ToCss for QueryFeatureExpression { where W: fmt::Write, { - dest.write_str("(")?; + dest.write_char('(')?; match self.kind { QueryFeatureExpressionKind::Empty => self.write_name(dest)?, diff --git a/components/style/selector_parser.rs b/components/style/selector_parser.rs index c401fe431ce..baf9ce83e61 100644 --- a/components/style/selector_parser.rs +++ b/components/style/selector_parser.rs @@ -129,7 +129,7 @@ where T: Debug, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str("[")?; + f.write_char('[')?; let mut first = true; for entry in self.entries.iter() { if !first { @@ -138,7 +138,7 @@ where first = false; entry.fmt(f)?; } - f.write_str("]") + f.write_char(']') } } diff --git a/components/style/servo/selector_parser.rs b/components/style/servo/selector_parser.rs index 901ef71071e..08431dba684 100644 --- a/components/style/servo/selector_parser.rs +++ b/components/style/servo/selector_parser.rs @@ -337,7 +337,7 @@ impl ToCss for NonTSPseudoClass { if let Lang(ref lang) = *self { dest.write_str(":lang(")?; serialize_identifier(lang, dest)?; - return dest.write_str(")"); + return dest.write_char(')'); } dest.write_str(match *self { diff --git a/components/style/servo/url.rs b/components/style/servo/url.rs index f4ae4e25edf..2186be7aabd 100644 --- a/components/style/servo/url.rs +++ b/components/style/servo/url.rs @@ -158,7 +158,7 @@ impl ToCss for CssUrl { dest.write_str("url(")?; string.to_css(dest)?; - dest.write_str(")") + dest.write_char(')') } } @@ -230,7 +230,7 @@ impl ToCss for ComputedUrl { dest.write_str("url(")?; string.to_css(dest)?; - dest.write_str(")") + dest.write_char(')') } } diff --git a/components/style/stylesheets/document_rule.rs b/components/style/stylesheets/document_rule.rs index c4e70855801..baf2dd21e71 100644 --- a/components/style/stylesheets/document_rule.rs +++ b/components/style/stylesheets/document_rule.rs @@ -47,7 +47,7 @@ impl ToCssWithGuard for DocumentRule { self.condition.to_css(&mut CssWriter::new(dest))?; dest.write_str(" {")?; for rule in self.rules.read_with(guard).0.iter() { - dest.write_str(" ")?; + dest.write_char(' ')?; rule.to_css(guard, dest)?; } dest.write_str(" }") diff --git a/components/style/stylesheets/font_feature_values_rule.rs b/components/style/stylesheets/font_feature_values_rule.rs index 784628f0dde..33b57e5fcfd 100644 --- a/components/style/stylesheets/font_feature_values_rule.rs +++ b/components/style/stylesheets/font_feature_values_rule.rs @@ -46,7 +46,7 @@ impl ToCss for FFVDeclaration { serialize_atom_identifier(&self.name, dest)?; dest.write_str(": ")?; self.value.to_css(dest)?; - dest.write_str(";") + dest.write_char(';') } } @@ -335,7 +335,7 @@ macro_rules! font_feature_values_blocks { self.family_names.to_css(&mut CssWriter::new(dest))?; dest.write_str(" {\n")?; self.value_to_css(&mut CssWriter::new(dest))?; - dest.write_str("}") + dest.write_char('}') } } diff --git a/components/style/stylesheets/font_palette_values_rule.rs b/components/style/stylesheets/font_palette_values_rule.rs index 3bfae5e6b1b..b6085b7884d 100644 --- a/components/style/stylesheets/font_palette_values_rule.rs +++ b/components/style/stylesheets/font_palette_values_rule.rs @@ -61,7 +61,7 @@ impl ToCss for FontPaletteOverrideColor { W: fmt::Write, { self.index.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; self.color.to_css(dest) } } @@ -200,7 +200,7 @@ impl ToCssWithGuard for FontPaletteValuesRule { self.name.to_css(&mut CssWriter::new(dest))?; dest.write_str(" { ")?; self.value_to_css(&mut CssWriter::new(dest))?; - dest.write_str("}") + dest.write_char('}') } } diff --git a/components/style/stylesheets/style_rule.rs b/components/style/stylesheets/style_rule.rs index 905e067f730..1d4a2e27316 100644 --- a/components/style/stylesheets/style_rule.rs +++ b/components/style/stylesheets/style_rule.rs @@ -71,9 +71,9 @@ impl ToCssWithGuard for StyleRule { declaration_block.to_css(dest)?; // Step 4 if !declaration_block.declarations().is_empty() { - dest.write_str(" ")?; + dest.write_char(' ')?; } // Step 5 - dest.write_str("}") + dest.write_char('}') } } diff --git a/components/style/stylesheets/supports_rule.rs b/components/style/stylesheets/supports_rule.rs index b0bda2a6169..763e1f891a1 100644 --- a/components/style/stylesheets/supports_rule.rs +++ b/components/style/stylesheets/supports_rule.rs @@ -296,9 +296,9 @@ impl ToCss for SupportsCondition { cond.to_css(dest) }, SupportsCondition::Parenthesized(ref cond) => { - dest.write_str("(")?; + dest.write_char('(')?; cond.to_css(dest)?; - dest.write_str(")") + dest.write_char(')') }, SupportsCondition::And(ref vec) => { let mut first = true; @@ -323,31 +323,31 @@ impl ToCss for SupportsCondition { Ok(()) }, SupportsCondition::Declaration(ref decl) => { - dest.write_str("(")?; + dest.write_char('(')?; decl.to_css(dest)?; - dest.write_str(")") + dest.write_char(')') }, SupportsCondition::Selector(ref selector) => { dest.write_str("selector(")?; selector.to_css(dest)?; - dest.write_str(")") + dest.write_char(')') }, SupportsCondition::MozBoolPref(ref name) => { dest.write_str("-moz-bool-pref(")?; let name = str::from_utf8(name.as_bytes()).expect("Should be parsed from valid UTF-8"); name.to_css(dest)?; - dest.write_str(")") + dest.write_char(')') }, SupportsCondition::FontFormat(ref kw) => { dest.write_str("font-format(")?; kw.to_css(dest)?; - dest.write_str(")") + dest.write_char(')') }, SupportsCondition::FontTech(ref flag) => { dest.write_str("font-tech(")?; flag.to_css(dest)?; - dest.write_str(")") + dest.write_char(')') }, SupportsCondition::FutureSyntax(ref s) => dest.write_str(&s), } diff --git a/components/style/stylesheets/viewport_rule.rs b/components/style/stylesheets/viewport_rule.rs index 42a29a4b6ec..73e16201638 100644 --- a/components/style/stylesheets/viewport_rule.rs +++ b/components/style/stylesheets/viewport_rule.rs @@ -108,7 +108,7 @@ macro_rules! declare_viewport_descriptor_inner { }, )* } - dest.write_str(";") + dest.write_char(';') } } }; @@ -504,7 +504,7 @@ impl ToCssWithGuard for ViewportRule { let mut iter = self.declarations.iter(); iter.next().unwrap().to_css(&mut CssWriter::new(dest))?; for declaration in iter { - dest.write_str(" ")?; + dest.write_char(' ')?; declaration.to_css(&mut CssWriter::new(dest))?; } dest.write_str(" }") diff --git a/components/style/values/computed/image.rs b/components/style/values/computed/image.rs index 5f650631c89..fc484979153 100644 --- a/components/style/values/computed/image.rs +++ b/components/style/values/computed/image.rs @@ -177,7 +177,7 @@ impl generic::LineDirection for LineDirection { dest.write_str("to ")?; } x.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; y.to_css(dest) }, } diff --git a/components/style/values/computed/position.rs b/components/style/values/computed/position.rs index 6d09e327e63..5a10c0f23d7 100644 --- a/components/style/values/computed/position.rs +++ b/components/style/values/computed/position.rs @@ -53,7 +53,7 @@ impl ToCss for Position { W: Write, { self.horizontal.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; self.vertical.to_css(dest) } } diff --git a/components/style/values/computed/text.rs b/components/style/values/computed/text.rs index c2b017f3973..ff4d87fa93e 100644 --- a/components/style/values/computed/text.rs +++ b/components/style/values/computed/text.rs @@ -161,7 +161,7 @@ impl ToCss for TextOverflow { self.second.to_css(dest)?; } else { self.first.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; self.second.to_css(dest)?; } Ok(()) diff --git a/components/style/values/computed/time.rs b/components/style/values/computed/time.rs index 1f0a6df018b..f542333a823 100644 --- a/components/style/values/computed/time.rs +++ b/components/style/values/computed/time.rs @@ -40,6 +40,6 @@ impl ToCss for Time { W: Write, { self.seconds().to_css(dest)?; - dest.write_str("s") + dest.write_char('s') } } diff --git a/components/style/values/generics/basic_shape.rs b/components/style/values/generics/basic_shape.rs index 5e1bafb2230..870b6c82b5b 100644 --- a/components/style/values/generics/basic_shape.rs +++ b/components/style/values/generics/basic_shape.rs @@ -418,7 +418,7 @@ where dest.write_str(" round ")?; self.round.to_css(dest)?; } - dest.write_str(")") + dest.write_char(')') } } @@ -434,11 +434,11 @@ where dest.write_str("circle(")?; if self.radius != Default::default() { self.radius.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; } dest.write_str("at ")?; self.position.to_css(dest)?; - dest.write_str(")") + dest.write_char(')') } } @@ -454,13 +454,13 @@ where dest.write_str("ellipse(")?; if self.semiaxis_x != Default::default() || self.semiaxis_y != Default::default() { self.semiaxis_x.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; self.semiaxis_y.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; } dest.write_str("at ")?; self.position.to_css(dest)?; - dest.write_str(")") + dest.write_char(')') } } diff --git a/components/style/values/generics/calc.rs b/components/style/values/generics/calc.rs index 24b0cf23a32..9175a0debf6 100644 --- a/components/style/values/generics/calc.rs +++ b/components/style/values/generics/calc.rs @@ -1078,7 +1078,7 @@ impl CalcNode { } if write_closing_paren { - dest.write_str(")")?; + dest.write_char(')')?; } Ok(()) } diff --git a/components/style/values/generics/color.rs b/components/style/values/generics/color.rs index 6c82cbf2aed..439be95ca44 100644 --- a/components/style/values/generics/color.rs +++ b/components/style/values/generics/color.rs @@ -230,16 +230,16 @@ impl ToCss for ColorMix ToCss for TrackSize { min.to_css(dest)?; dest.write_str(", ")?; max.to_css(dest)?; - dest.write_str(")") + dest.write_char(')') }, TrackSize::FitContent(ref lp) => { dest.write_str("fit-content(")?; lp.to_css(dest)?; - dest.write_str(")") + dest.write_char(')') }, } } @@ -493,7 +493,7 @@ impl ToCss for TrackRepeat { .enumerate() { if i > 0 { - dest.write_str(" ")?; + dest.write_char(' ')?; } concat_serialize_idents("[", "] ", names, " ", dest)?; @@ -504,7 +504,7 @@ impl ToCss for TrackRepeat { concat_serialize_idents(" [", "]", line_names_last, " ", dest)?; } - dest.write_str(")")?; + dest.write_char(')')?; Ok(()) } @@ -615,7 +615,7 @@ impl ToCss for TrackList { match values_iter.next() { Some(value) => { if !names.is_empty() { - dest.write_str(" ")?; + dest.write_char(' ')?; } value.to_css(dest)?; @@ -627,7 +627,7 @@ impl ToCss for TrackList { line_names_iter.peek().map_or(false, |v| !v.is_empty()) || (idx + 1 == self.auto_repeat_index) { - dest.write_str(" ")?; + dest.write_char(' ')?; } } @@ -753,14 +753,14 @@ impl ToCss for LineNameList { if let Some((ref first, rest)) = names.split_first() { first.to_css(dest)?; for name in rest { - dest.write_str(" ")?; + dest.write_char(' ')?; name.to_css(dest)?; } } - dest.write_str("]")?; + dest.write_char(']')?; if fill_len > 0 && i == fill_start + fill_len - 1 { - dest.write_str(")")?; + dest.write_char(')')?; } } diff --git a/components/style/values/generics/image.rs b/components/style/values/generics/image.rs index d5e830810a8..3b84d982381 100644 --- a/components/style/values/generics/image.rs +++ b/components/style/values/generics/image.rs @@ -142,14 +142,14 @@ impl ToCss for GenericImageSetIt W: fmt::Write, { self.image.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; self.resolution.to_css(dest)?; if self.has_mime_type { - dest.write_str(" ")?; + dest.write_char(' ')?; dest.write_str("type(")?; self.mime_type.to_css(dest)?; - dest.write_str(")")?; + dest.write_char(')')?; } Ok(()) } @@ -369,7 +369,7 @@ impl ToCss for PaintWorklet { dest.write_str(", ")?; argument.to_css(dest)?; } - dest.write_str(")") + dest.write_char(')') } } @@ -433,7 +433,7 @@ where Image::Element(ref selector) => { dest.write_str("-moz-element(#")?; serialize_atom_identifier(selector, dest)?; - dest.write_str(")") + dest.write_char(')') }, Image::ImageSet(ref is) => is.to_css(dest), Image::CrossFade(ref cf) => cf.to_css(dest), @@ -520,7 +520,7 @@ where if !omit_shape { shape.to_css(dest)?; if !omit_position { - dest.write_str(" ")?; + dest.write_char(' ')?; } } if !omit_position { @@ -560,7 +560,7 @@ where dest.write_str("from ")?; angle.to_css(dest)?; if !omit_position { - dest.write_str(" ")?; + dest.write_char(' ')?; } } if !omit_position { @@ -577,7 +577,7 @@ where } }, } - dest.write_str(")") + dest.write_char(')') } } diff --git a/components/style/values/generics/rect.rs b/components/style/values/generics/rect.rs index dee21459a77..e6358373d66 100644 --- a/components/style/values/generics/rect.rs +++ b/components/style/values/generics/rect.rs @@ -110,17 +110,17 @@ where if same_vertical && same_horizontal && self.0 == self.1 { return Ok(()); } - dest.write_str(" ")?; + dest.write_char(' ')?; self.1.to_css(dest)?; if same_vertical && same_horizontal { return Ok(()); } - dest.write_str(" ")?; + dest.write_char(' ')?; self.2.to_css(dest)?; if same_horizontal { return Ok(()); } - dest.write_str(" ")?; + dest.write_char(' ')?; self.3.to_css(dest) } } diff --git a/components/style/values/generics/size.rs b/components/style/values/generics/size.rs index e00eef28b93..0027245e488 100644 --- a/components/style/values/generics/size.rs +++ b/components/style/values/generics/size.rs @@ -80,7 +80,7 @@ where self.width.to_css(dest)?; if self.height != self.width { - dest.write_str(" ")?; + dest.write_char(' ')?; self.height.to_css(dest)?; } diff --git a/components/style/values/generics/ui.rs b/components/style/values/generics/ui.rs index 3db04e6586a..1b7dac1da02 100644 --- a/components/style/values/generics/ui.rs +++ b/components/style/values/generics/ui.rs @@ -79,9 +79,9 @@ impl ToCss for CursorImage { { self.image.to_css(dest)?; if self.has_hotspot { - dest.write_str(" ")?; + dest.write_char(' ')?; self.hotspot_x.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; self.hotspot_y.to_css(dest)?; } Ok(()) diff --git a/components/style/values/mod.rs b/components/style/values/mod.rs index adff582974c..ac43ea62694 100644 --- a/components/style/values/mod.rs +++ b/components/style/values/mod.rs @@ -360,7 +360,7 @@ where W: Write, { (value * 100.).to_css(dest)?; - dest.write_str("%") + dest.write_char('%') } /// Convenience void type to disable some properties and values through types. diff --git a/components/style/values/specified/angle.rs b/components/style/values/specified/angle.rs index 08c6b443678..0c8c030a9ca 100644 --- a/components/style/values/specified/angle.rs +++ b/components/style/values/specified/angle.rs @@ -97,7 +97,7 @@ impl ToCss for Angle { } self.value.to_css(dest)?; if self.was_calc { - dest.write_str(")")?; + dest.write_char(')')?; } Ok(()) } diff --git a/components/style/values/specified/background.rs b/components/style/values/specified/background.rs index 29f6d6b352f..39a5a85193d 100644 --- a/components/style/values/specified/background.rs +++ b/components/style/values/specified/background.rs @@ -102,7 +102,7 @@ impl ToCss for BackgroundRepeat { (horizontal, vertical) => { horizontal.to_css(dest)?; if horizontal != vertical { - dest.write_str(" ")?; + dest.write_char(' ')?; vertical.to_css(dest)?; } Ok(()) diff --git a/components/style/values/specified/border.rs b/components/style/values/specified/border.rs index 817a5aadddb..6fe179de71f 100644 --- a/components/style/values/specified/border.rs +++ b/components/style/values/specified/border.rs @@ -278,7 +278,7 @@ impl ToCss for BorderImageRepeat { { self.0.to_css(dest)?; if self.0 != self.1 { - dest.write_str(" ")?; + dest.write_char(' ')?; self.1.to_css(dest)?; } Ok(()) diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs index c72517ffaec..48d778c5904 100644 --- a/components/style/values/specified/box.rs +++ b/components/style/values/specified/box.rs @@ -400,11 +400,11 @@ impl ToCss for Display { if self.is_list_item() { if outside != DisplayOutside::Block { outside.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; } if inside != DisplayInside::Flow { inside.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; } dest.write_str("list-item") } else { @@ -969,7 +969,7 @@ impl ToCss for ScrollSnapType { } self.axis.to_css(dest)?; if self.strictness != ScrollSnapStrictness::Proximity { - dest.write_str(" ")?; + dest.write_char(' ')?; self.strictness.to_css(dest)?; } Ok(()) @@ -1054,7 +1054,7 @@ impl ToCss for ScrollSnapAlign { { self.block.to_css(dest)?; if self.block != self.inline { - dest.write_str(" ")?; + dest.write_char(' ')?; self.inline.to_css(dest)?; } Ok(()) diff --git a/components/style/values/specified/image.rs b/components/style/values/specified/image.rs index 3eec04893e3..3be84c5a7b2 100644 --- a/components/style/values/specified/image.rs +++ b/components/style/values/specified/image.rs @@ -947,7 +947,7 @@ impl generic::LineDirection for LineDirection { dest.write_str("to ")?; } x.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; y.to_css(dest) }, } diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 3daa61a366b..a566a3fdf89 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -319,7 +319,7 @@ impl ToCss for Number { } self.value.to_css(dest)?; if self.calc_clamping_mode.is_some() { - dest.write_str(")")?; + dest.write_char(')')?; } Ok(()) } @@ -702,7 +702,7 @@ impl ToCss for Integer { } self.value.to_css(dest)?; if self.was_calc { - dest.write_str(")")?; + dest.write_char(')')?; } Ok(()) } @@ -950,9 +950,9 @@ impl ToCss for Attr { dest.write_str("attr(")?; if !self.namespace_prefix.is_empty() { serialize_atom_identifier(&self.namespace_prefix, dest)?; - dest.write_str("|")?; + dest.write_char('|')?; } serialize_atom_identifier(&self.attribute, dest)?; - dest.write_str(")") + dest.write_char(')') } } diff --git a/components/style/values/specified/percentage.rs b/components/style/values/specified/percentage.rs index ba5f92db924..62dca187635 100644 --- a/components/style/values/specified/percentage.rs +++ b/components/style/values/specified/percentage.rs @@ -40,7 +40,7 @@ impl ToCss for Percentage { serialize_percentage(self.value, dest)?; if self.calc_clamping_mode.is_some() { - dest.write_str(")")?; + dest.write_char(')')?; } Ok(()) } diff --git a/components/style/values/specified/position.rs b/components/style/values/specified/position.rs index e447c52f0c4..06456a312fc 100644 --- a/components/style/values/specified/position.rs +++ b/components/style/values/specified/position.rs @@ -224,12 +224,12 @@ impl ToCss for Position { ) => { dest.write_str("left ")?; x_lp.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; y_pos.to_css(dest) }, (x_pos, y_pos) => { x_pos.to_css(dest)?; - dest.write_str(" ")?; + dest.write_char(' ')?; y_pos.to_css(dest) }, } diff --git a/components/style/values/specified/svg.rs b/components/style/values/specified/svg.rs index f06fc43c46d..73e0b16ac5c 100644 --- a/components/style/values/specified/svg.rs +++ b/components/style/values/specified/svg.rs @@ -239,7 +239,7 @@ impl ToCss for SVGPaintOrder { for pos in 0..last_pos_to_serialize + 1 { if pos != 0 { - dest.write_str(" ")? + dest.write_char(' ')? } self.order_at(pos).to_css(dest)?; } diff --git a/components/style/values/specified/text.rs b/components/style/values/specified/text.rs index b782780c955..8545a4fc01a 100644 --- a/components/style/values/specified/text.rs +++ b/components/style/values/specified/text.rs @@ -373,7 +373,7 @@ impl ToCss for TextTransform { if self.case_ != TextTransformCase::None { self.case_.to_css(dest)?; if !self.other_.is_empty() { - dest.write_str(" ")?; + dest.write_char(' ')?; } } diff --git a/components/style/values/specified/time.rs b/components/style/values/specified/time.rs index aba3f0a828f..bac9efd413c 100644 --- a/components/style/values/specified/time.rs +++ b/components/style/values/specified/time.rs @@ -159,7 +159,7 @@ impl ToCss for Time { match self.unit { TimeUnit::Second => { self.seconds.to_css(dest)?; - dest.write_str("s")?; + dest.write_char('s')?; }, TimeUnit::Millisecond => { (self.seconds * 1000.).to_css(dest)?; @@ -167,7 +167,7 @@ impl ToCss for Time { }, } if self.was_calc { - dest.write_str(")")?; + dest.write_char(')')?; } Ok(()) }