Bug 1560777 - Fix various nightly warnings in Servo-only code.
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 23 Jun 2019 12:54:27 +0200
changeset 479906 322c3ae81799c7edcde44471a2e225998a9d61c4
parent 479905 4ba30243e4a2059688d8e7d9a1ab02658e788605
child 479907 c90edb8e903d224c775f541477d9170ace8471c9
push id88354
push useremilio@crisal.io
push dateSun, 23 Jun 2019 11:28:20 +0000
treeherderautoland@4ed761cebb7f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1560777
milestone69.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 1560777 - Fix various nightly warnings in Servo-only code.
servo/components/style/attr.rs
servo/components/style/context.rs
servo/components/style/encoding_support.rs
servo/components/style/matching.rs
--- a/servo/components/style/attr.rs
+++ b/servo/components/style/attr.rs
@@ -503,19 +503,19 @@ pub fn parse_legacy_color(mut input: &st
         hex_string(red).unwrap(),
         hex_string(green).unwrap(),
         hex_string(blue).unwrap(),
         255,
     ));
 
     fn hex(ch: char) -> Result<u8, ()> {
         match ch {
-            '0'...'9' => Ok((ch as u8) - b'0'),
-            'a'...'f' => Ok((ch as u8) - b'a' + 10),
-            'A'...'F' => Ok((ch as u8) - b'A' + 10),
+            '0'..='9' => Ok((ch as u8) - b'0'),
+            'a'..='f' => Ok((ch as u8) - b'a' + 10),
+            'A'..='F' => Ok((ch as u8) - b'A' + 10),
             _ => Err(()),
         }
     }
 
     fn hex_string(string: &[u8]) -> Result<u8, ()> {
         match string.len() {
             0 => Err(()),
             1 => hex(string[0] as char),
@@ -545,32 +545,32 @@ pub fn parse_length(mut value: &str) -> 
 
     // Step 5
     if value.starts_with('+') {
         value = &value[1..]
     }
 
     // Steps 6 & 7
     match value.chars().nth(0) {
-        Some('0'...'9') => {},
+        Some('0'..='9') => {},
         _ => return LengthOrPercentageOrAuto::Auto,
     }
 
     // Steps 8 to 13
     // We trim the string length to the minimum of:
     // 1. the end of the string
     // 2. the first occurence of a '%' (U+0025 PERCENT SIGN)
     // 3. the second occurrence of a '.' (U+002E FULL STOP)
     // 4. the occurrence of a character that is neither a digit nor '%' nor '.'
     // Note: Step 10 is directly subsumed by FromStr::from_str
     let mut end_index = value.len();
     let (mut found_full_stop, mut found_percent) = (false, false);
     for (i, ch) in value.chars().enumerate() {
         match ch {
-            '0'...'9' => continue,
+            '0'..='9' => continue,
             '%' => {
                 found_percent = true;
                 end_index = i;
                 break;
             },
             '.' if !found_full_stop => {
                 found_full_stop = true;
                 continue;
--- a/servo/components/style/context.rs
+++ b/servo/components/style/context.rs
@@ -176,17 +176,17 @@ pub struct SharedStyleContext<'a> {
     pub running_animations: Arc<RwLock<FxHashMap<OpaqueNode, Vec<Animation>>>>,
 
     /// The list of animations that have expired since the last style recalculation.
     #[cfg(feature = "servo")]
     pub expired_animations: Arc<RwLock<FxHashMap<OpaqueNode, Vec<Animation>>>>,
 
     /// Paint worklets
     #[cfg(feature = "servo")]
-    pub registered_speculative_painters: &'a RegisteredSpeculativePainters,
+    pub registered_speculative_painters: &'a dyn RegisteredSpeculativePainters,
 
     /// Data needed to create the thread-local style context from the shared one.
     #[cfg(feature = "servo")]
     pub local_context_creation_data: Mutex<ThreadLocalStyleContextCreationInfo>,
 }
 
 impl<'a> SharedStyleContext<'a> {
     /// Return a suitable viewport size in order to be used for viewport units.
@@ -821,10 +821,10 @@ pub trait RegisteredSpeculativePainter: 
     /// The properties it was registered with
     fn properties(&self) -> &FxHashMap<Atom, PropertyId>;
 }
 
 /// A set of registered painters
 #[cfg(feature = "servo")]
 pub trait RegisteredSpeculativePainters: Sync {
     /// Look up a speculative painter
-    fn get(&self, name: &Atom) -> Option<&RegisteredSpeculativePainter>;
+    fn get(&self, name: &Atom) -> Option<&dyn RegisteredSpeculativePainter>;
 }
--- a/servo/components/style/encoding_support.rs
+++ b/servo/components/style/encoding_support.rs
@@ -58,18 +58,18 @@ impl Stylesheet {
     pub fn from_bytes(
         bytes: &[u8],
         url_data: UrlExtraData,
         protocol_encoding_label: Option<&str>,
         environment_encoding: Option<&'static encoding_rs::Encoding>,
         origin: Origin,
         media: MediaList,
         shared_lock: SharedRwLock,
-        stylesheet_loader: Option<&StylesheetLoader>,
-        error_reporter: Option<&ParseErrorReporter>,
+        stylesheet_loader: Option<&dyn StylesheetLoader>,
+        error_reporter: Option<&dyn ParseErrorReporter>,
         quirks_mode: QuirksMode,
     ) -> Stylesheet {
         let string = decode_stylesheet_bytes(bytes, protocol_encoding_label, environment_encoding);
         Stylesheet::from_str(
             &string,
             url_data,
             origin,
             Arc::new(shared_lock.wrap(media)),
@@ -84,18 +84,18 @@ impl Stylesheet {
     /// Updates an empty stylesheet with a set of bytes that reached over the
     /// network.
     pub fn update_from_bytes(
         existing: &Stylesheet,
         bytes: &[u8],
         protocol_encoding_label: Option<&str>,
         environment_encoding: Option<&'static encoding_rs::Encoding>,
         url_data: UrlExtraData,
-        stylesheet_loader: Option<&StylesheetLoader>,
-        error_reporter: Option<&ParseErrorReporter>,
+        stylesheet_loader: Option<&dyn StylesheetLoader>,
+        error_reporter: Option<&dyn ParseErrorReporter>,
     ) {
         let string = decode_stylesheet_bytes(bytes, protocol_encoding_label, environment_encoding);
         Self::update_from_str(
             existing,
             &string,
             url_data,
             stylesheet_loader,
             error_reporter,
--- a/servo/components/style/matching.rs
+++ b/servo/components/style/matching.rs
@@ -577,17 +577,17 @@ trait PrivateMatchMethods: TElement {
     // get, but the functions called (mainly update_style_for_animation) expects
     // the new style, wtf?
     #[cfg(feature = "servo")]
     fn update_animations_for_cascade(
         &self,
         context: &SharedStyleContext,
         style: &mut Arc<ComputedValues>,
         possibly_expired_animations: &mut Vec<crate::animation::PropertyAnimation>,
-        font_metrics: &crate::font_metrics::FontMetricsProvider,
+        font_metrics: &dyn crate::font_metrics::FontMetricsProvider,
     ) {
         use crate::animation::{self, Animation, AnimationUpdate};
         use crate::dom::TNode;
 
         // Finish any expired transitions.
         let this_opaque = self.as_node().opaque();
         animation::complete_expired_transitions(this_opaque, style, context);