Bug 1516829 - Replace trim_{left,right}* with trim_{start,end}*. r=emilio
authorXidorn Quan <me@upsuper.org>
Sun, 30 Dec 2018 08:37:19 +0000
changeset 509261 a22cf2ec4f2dbfa6f860ba317c24ee1079d24653
parent 509237 592d38d2892f86e768f64ffcbf93878a2d0e8b61
child 509262 bf82f8b197f3c2cc83ade5c8c7c27d25bc003c3e
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1516829
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1516829 - Replace trim_{left,right}* with trim_{start,end}*. r=emilio Differential Revision: https://phabricator.services.mozilla.com/D15496
servo/components/style/attr.rs
servo/components/style/values/computed/font.rs
servo/components/style/values/specified/position.rs
servo/components/style_derive/cg.rs
--- a/servo/components/style/attr.rs
+++ b/servo/components/style/attr.rs
@@ -543,17 +543,17 @@ pub fn parse_legacy_color(mut input: &st
 /// Parses a [dimension value][dim]. If unparseable, `Auto` is returned.
 ///
 /// [dim]: https://html.spec.whatwg.org/multipage/#rules-for-parsing-dimension-values
 // TODO: this function can be rewritten to return Result<LengthOrPercentage, _>
 pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto {
     // Steps 1 & 2 are not relevant
 
     // Step 3
-    value = value.trim_left_matches(HTML_SPACE_CHARACTERS);
+    value = value.trim_start_matches(HTML_SPACE_CHARACTERS);
 
     // Step 4
     if value.is_empty() {
         return LengthOrPercentageOrAuto::Auto;
     }
 
     // Step 5
     if value.starts_with('+') {
--- a/servo/components/style/values/computed/font.rs
+++ b/servo/components/style/values/computed/font.rs
@@ -773,17 +773,17 @@ impl ToCss for FontLanguageOverride {
         let mut buf = [0; 4];
         BigEndian::write_u32(&mut buf, self.0);
         // Safe because we ensure it's ASCII during computing
         let slice = if cfg!(debug_assertions) {
             str::from_utf8(&buf).unwrap()
         } else {
             unsafe { str::from_utf8_unchecked(&buf) }
         };
-        slice.trim_right().to_css(dest)
+        slice.trim_end().to_css(dest)
     }
 }
 
 #[cfg(feature = "gecko")]
 impl From<u32> for FontLanguageOverride {
     fn from(bits: u32) -> FontLanguageOverride {
         FontLanguageOverride(bits)
     }
--- a/servo/components/style/values/specified/position.rs
+++ b/servo/components/style/values/specified/position.rs
@@ -687,17 +687,17 @@ pub struct NamedArea {
 /// Tokenize the string into a list of the tokens,
 /// using longest-match semantics
 struct TemplateAreasTokenizer<'a>(&'a str);
 
 impl<'a> Iterator for TemplateAreasTokenizer<'a> {
     type Item = Result<Option<&'a str>, ()>;
 
     fn next(&mut self) -> Option<Self::Item> {
-        let rest = self.0.trim_left_matches(HTML_SPACE_CHARACTERS);
+        let rest = self.0.trim_start_matches(HTML_SPACE_CHARACTERS);
         if rest.is_empty() {
             return None;
         }
         if rest.starts_with('.') {
             self.0 = &rest[rest.find(|c| c != '.').unwrap_or(rest.len())..];
             return Some(Ok(None));
         }
         if !rest.starts_with(is_name_code_point) {
--- a/servo/components/style_derive/cg.rs
+++ b/servo/components/style_derive/cg.rs
@@ -249,17 +249,17 @@ pub fn value<'a>(variant: &'a VariantInf
     (v.pat(), v.bindings().iter().cloned().collect())
 }
 
 /// Transforms "FooBar" to "foo-bar".
 ///
 /// If the first Camel segment is "Moz", "Webkit", or "Servo", the result string
 /// is prepended with "-".
 pub fn to_css_identifier(mut camel_case: &str) -> String {
-    camel_case = camel_case.trim_right_matches('_');
+    camel_case = camel_case.trim_end_matches('_');
     let mut first = true;
     let mut result = String::with_capacity(camel_case.len());
     while let Some(segment) = split_camel_segment(&mut camel_case) {
         if first {
             match segment {
                 "Moz" | "Webkit" | "Servo" => first = false,
                 _ => {},
             }