From be2218a13467e33728932a846ce86903762abe6c Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Wed, 26 Dec 2018 10:58:50 +0100 Subject: [PATCH] Fix some warnings --- components/net_traits/pub_domains.rs | 6 +++--- components/net_traits/quality.rs | 2 +- components/style/attr.rs | 2 +- components/style/values/computed/font.rs | 2 +- components/style/values/specified/position.rs | 2 +- components/style_derive/cg.rs | 2 +- ports/libmlservo/src/lib.rs | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/net_traits/pub_domains.rs b/components/net_traits/pub_domains.rs index 45a338829de2..95090791f2b5 100644 --- a/components/net_traits/pub_domains.rs +++ b/components/net_traits/pub_domains.rs @@ -66,7 +66,7 @@ impl PubDomainRules { .collect() } fn suffix_pair<'a>(&self, domain: &'a str) -> (&'a str, &'a str) { - let domain = domain.trim_left_matches("."); + let domain = domain.trim_start_matches("."); let mut suffix = domain; let mut prev_suffix = domain; for (index, _) in domain.match_indices(".") { @@ -96,7 +96,7 @@ impl PubDomainRules { // Speeded-up version of // domain != "" && // self.public_suffix(domain) == domain. - let domain = domain.trim_left_matches("."); + let domain = domain.trim_start_matches("."); match domain.find(".") { None => !domain.is_empty(), Some(index) => { @@ -109,7 +109,7 @@ impl PubDomainRules { // Speeded-up version of // self.public_suffix(domain) != domain && // self.registrable_suffix(domain) == domain. - let domain = domain.trim_left_matches("."); + let domain = domain.trim_start_matches("."); match domain.find(".") { None => false, Some(index) => { diff --git a/components/net_traits/quality.rs b/components/net_traits/quality.rs index fe53b2201fc1..e5e9fcc42cdc 100644 --- a/components/net_traits/quality.rs +++ b/components/net_traits/quality.rs @@ -69,7 +69,7 @@ where digits[0] = (x % 10) as u8 + b'0'; let s = str::from_utf8(&digits[..]).unwrap(); - fmt.write_str(s.trim_right_matches('0')) + fmt.write_str(s.trim_end_matches('0')) }, } } diff --git a/components/style/attr.rs b/components/style/attr.rs index 780248a2221f..16173d640571 100644 --- a/components/style/attr.rs +++ b/components/style/attr.rs @@ -548,7 +548,7 @@ 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() { diff --git a/components/style/values/computed/font.rs b/components/style/values/computed/font.rs index ad795ff6b295..765efd9a0d87 100644 --- a/components/style/values/computed/font.rs +++ b/components/style/values/computed/font.rs @@ -778,7 +778,7 @@ impl ToCss for FontLanguageOverride { } else { unsafe { str::from_utf8_unchecked(&buf) } }; - slice.trim_right().to_css(dest) + slice.trim_end().to_css(dest) } } diff --git a/components/style/values/specified/position.rs b/components/style/values/specified/position.rs index ba55f34ce52e..e2865071eeb4 100644 --- a/components/style/values/specified/position.rs +++ b/components/style/values/specified/position.rs @@ -692,7 +692,7 @@ impl<'a> Iterator for TemplateAreasTokenizer<'a> { type Item = Result, ()>; fn next(&mut self) -> Option { - 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; } diff --git a/components/style_derive/cg.rs b/components/style_derive/cg.rs index 24c33a8e7a7b..6eeca384bfa4 100644 --- a/components/style_derive/cg.rs +++ b/components/style_derive/cg.rs @@ -252,7 +252,7 @@ pub fn value<'a>(variant: &'a VariantInfo, prefix: &str) -> (TokenStream, Vec 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) { diff --git a/ports/libmlservo/src/lib.rs b/ports/libmlservo/src/lib.rs index b930ed1c1f99..59799d408287 100644 --- a/ports/libmlservo/src/lib.rs +++ b/ports/libmlservo/src/lib.rs @@ -161,7 +161,7 @@ pub unsafe extern "C" fn heartbeat_servo(servo: *mut ServoInstance) { // Servo heartbeat goes here! if let Some(servo) = servo.as_mut() { servo.servo.handle_events(vec![]); - for ((browser_id, event)) in servo.servo.get_events() { + for (browser_id, event) in servo.servo.get_events() { match event { // Respond to any messages with a response channel // to avoid deadlocking the constellation @@ -554,7 +554,7 @@ impl log::Log for MLLogger { log::Level::Trace => MLLogLevel::Verbose, }; let mut msg = SmallVec::<[u8; 128]>::new(); - write!(msg, "{}\0", record.args()); + write!(msg, "{}\0", record.args()).unwrap(); (self.0)(lvl, &msg[0] as *const _ as *const _); }