servo: Merge #10928 - Fix some warnings (from servo:warnings); r=mbrubeck
authorSimon Sapin <simon.sapin@exyr.org>
Sat, 30 Apr 2016 05:16:46 -0700
changeset 338673 200256f1fb9e94651ecfc70da7231f586e283d5c
parent 338672 488a5dcdd1da3a67ca49456f34d286f2d45899dc
child 338674 65db4f77c0a6852aaa6c3a6f1464cf9eeb778c49
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
servo: Merge #10928 - Fix some warnings (from servo:warnings); r=mbrubeck Source-Repo: https://github.com/servo/servo Source-Revision: 0f1a921ba6731499fe89a82f14d9e01a3bd7c50b
servo/components/layout/fragment.rs
servo/components/layout/lib.rs
servo/components/layout/text.rs
servo/components/net/cookie_storage.rs
servo/components/net/lib.rs
--- a/servo/components/layout/fragment.rs
+++ b/servo/components/layout/fragment.rs
@@ -2016,18 +2016,17 @@ impl Fragment {
              &SpecificFragmentInfo::UnscannedText(_)) => {
                 // FIXME: Should probably use a whitelist of styles that can safely differ (#3165)
                 if self.style().get_font() != other.style().get_font() ||
                         self.text_decoration() != other.text_decoration() ||
                         self.white_space() != other.white_space() {
                     return false
                 }
 
-                let length = first_unscanned_text.text.len();
-                if length != 0 && first_unscanned_text.text.char_at_reverse(length) == '\n' {
+                if first_unscanned_text.text.ends_with('\n') {
                     return false
                 }
 
                 // If this node has any styles that have border/padding/margins on the following
                 // side, then we can't merge with the next fragment.
                 if let Some(ref inline_context) = self.inline_context {
                     for inline_context_node in inline_context.nodes.iter() {
                         if !inline_context_node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
--- a/servo/components/layout/lib.rs
+++ b/servo/components/layout/lib.rs
@@ -6,17 +6,16 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![feature(custom_derive)]
 #![feature(mpsc_select)]
 #![feature(nonzero)]
 #![feature(plugin)]
 #![feature(raw)]
 #![feature(step_by)]
-#![feature(str_char)]
 #![feature(unsafe_no_drop_flag)]
 
 #![deny(unsafe_code)]
 
 #![plugin(heapsize_plugin)]
 #![plugin(plugins)]
 
 extern crate app_units;
--- a/servo/components/layout/text.rs
+++ b/servo/components/layout/text.rs
@@ -334,25 +334,25 @@ impl TextRunScanner {
                             if let Some(ref mut last_fragment) = out_fragments.last_mut() {
                                 last_fragment.meld_with_next_inline_fragment(&old_fragment);
                             }
                             prev_fragments_to_meld.push(old_fragment);
                         }
                         break;
                     }
                 };
-                let mut mapping = mappings.next().unwrap();
+                let mapping = mappings.next().unwrap();
                 let scanned_run = runs[mapping.text_run_index].clone();
 
                 let mut byte_range = Range::new(ByteIndex(mapping.byte_range.begin() as isize),
                                                 ByteIndex(mapping.byte_range.length() as isize));
 
                 let requires_line_break_afterward_if_wrapping_on_newlines =
-                    !mapping.byte_range.is_empty() &&
-                    scanned_run.run.text.char_at_reverse(mapping.byte_range.end()) == '\n';
+                    scanned_run.run.text[mapping.byte_range.begin()..mapping.byte_range.end()]
+                    .ends_with('\n');
                 if requires_line_break_afterward_if_wrapping_on_newlines {
                     byte_range.extend_by(ByteIndex(-1)); // Trim the '\n'
                 }
 
                 let text_size = old_fragment.border_box.size;
 
                 let mut flags = ScannedTextFlags::empty();
                 if mapping.selected {
--- a/servo/components/net/cookie_storage.rs
+++ b/servo/components/net/cookie_storage.rs
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //! Implementation of cookie storage as specified in
 //! http://tools.ietf.org/html/rfc6265
 
 use cookie::Cookie;
 use net_traits::CookieSource;
-use rustc_serialize::{Encodable, Encoder};
+use rustc_serialize::Encoder;
 use std::cmp::Ordering;
 use url::Url;
 
 #[derive(Clone, RustcDecodable, RustcEncodable)]
 pub struct CookieStorage {
     version: u32,
     cookies: Vec<Cookie>
 }
--- a/servo/components/net/lib.rs
+++ b/servo/components/net/lib.rs
@@ -14,17 +14,17 @@
 extern crate brotli;
 extern crate cookie as cookie_rs;
 extern crate devtools_traits;
 extern crate flate2;
 extern crate hyper;
 extern crate immeta;
 extern crate ipc_channel;
 #[macro_use] extern crate log;
-#[macro_use] extern crate matches;
+#[macro_use] #[no_link] extern crate matches;
 #[macro_use]
 extern crate mime;
 extern crate mime_guess;
 extern crate msg;
 extern crate net_traits;
 extern crate openssl;
 extern crate rustc_serialize;
 extern crate threadpool;