Fix deprecation warnings

This commit is contained in:
Simon Sapin 2015-07-24 22:16:35 +02:00
parent 903a608c6a
commit a3c0366bd6
7 changed files with 15 additions and 15 deletions

View file

@ -5,7 +5,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(iter_arith)] #![feature(iter_arith)]
#![cfg_attr(target_os="linux", feature(page_size))] #![cfg_attr(target_os="linux", feature(page_size))]
#![feature(slice_extras)] #![feature(slice_splits)]
#[macro_use] extern crate log; #[macro_use] extern crate log;

View file

@ -249,14 +249,15 @@ impl ReportsForest {
// Insert the path and size into the forest, adding any trees and nodes as necessary. // Insert the path and size into the forest, adding any trees and nodes as necessary.
fn insert(&mut self, path: &[String], size: usize) { fn insert(&mut self, path: &[String], size: usize) {
let (head, tail) = path.split_first().unwrap();
// Get the right tree, creating it if necessary. // Get the right tree, creating it if necessary.
if !self.trees.contains_key(&path[0]) { if !self.trees.contains_key(head) {
self.trees.insert(path[0].clone(), ReportsTree::new(path[0].clone())); self.trees.insert(head.clone(), ReportsTree::new(head.clone()));
} }
let t = self.trees.get_mut(&path[0]).unwrap(); let t = self.trees.get_mut(head).unwrap();
// Use tail() because the 0th path segment was used to find the right tree in the forest. // Use tail because the 0th path segment was used to find the right tree in the forest.
t.insert(path.tail(), size); t.insert(tail, size);
} }
fn print(&mut self) { fn print(&mut self) {

View file

@ -1432,7 +1432,7 @@ impl<'a> DocumentMethods for &'a Document {
Some(ref title) => { Some(ref title) => {
// Steps 3-4. // Steps 3-4.
let value = Node::collect_text_contents(title.r().children()); let value = Node::collect_text_contents(title.r().children());
split_html_space_chars(&value).collect::<Vec<_>>().connect(" ") split_html_space_chars(&value).collect::<Vec<_>>().join(" ")
}, },
} }
} }

View file

@ -88,7 +88,7 @@ impl<'a> HTMLOptionElementMethods for &'a HTMLOptionElement {
let mut content = String::new(); let mut content = String::new();
collect_text(&node, &mut content); collect_text(&node, &mut content);
let v: Vec<&str> = split_html_space_chars(&content).collect(); let v: Vec<&str> = split_html_space_chars(&content).collect();
v.connect(" ") v.join(" ")
} }
// https://www.whatwg.org/html/#dom-option-text // https://www.whatwg.org/html/#dom-option-text

View file

@ -1060,7 +1060,7 @@ impl ScriptTask {
for it_page in self.root_page().iter() { for it_page in self.root_page().iter() {
urls.push(it_page.document().url().serialize()); urls.push(it_page.document().url().serialize());
} }
let path_seg = format!("url({})", urls.connect(", ")); let path_seg = format!("url({})", urls.join(", "));
let reports = ScriptTask::get_reports(self.get_cx(), path_seg); let reports = ScriptTask::get_reports(self.get_cx(), path_seg);
reports_chan.send(reports); reports_chan.send(reports);
} }

View file

@ -15,7 +15,7 @@
#![feature(path_ext)] #![feature(path_ext)]
#![feature(plugin)] #![feature(plugin)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(slice_extras)] #![feature(slice_splits)]
#![feature(step_by)] #![feature(step_by)]
#![feature(step_trait)] #![feature(step_trait)]
#![feature(zero_one)] #![feature(zero_one)]

View file

@ -267,8 +267,7 @@ pub fn default_opts() -> Opts {
} }
pub fn from_cmdline_args(args: &[String]) { pub fn from_cmdline_args(args: &[String]) {
let app_name = args[0].to_string(); let (app_name, args) = args.split_first().unwrap();
let args = args.tail();
let opts = vec!( let opts = vec!(
getopts::optflag("c", "cpu", "CPU painting (default)"), getopts::optflag("c", "cpu", "CPU painting (default)"),
@ -305,7 +304,7 @@ pub fn from_cmdline_args(args: &[String]) {
}; };
if opt_match.opt_present("h") || opt_match.opt_present("help") { if opt_match.opt_present("h") || opt_match.opt_present("help") {
print_usage(&app_name, &opts); print_usage(app_name, &opts);
process::exit(0); process::exit(0);
}; };
@ -318,11 +317,11 @@ pub fn from_cmdline_args(args: &[String]) {
debug_options.insert(split.clone()); debug_options.insert(split.clone());
} }
if debug_options.contains(&"help") { if debug_options.contains(&"help") {
print_debug_usage(&app_name) print_debug_usage(app_name)
} }
let url = if opt_match.free.is_empty() { let url = if opt_match.free.is_empty() {
print_usage(&app_name, &opts); print_usage(app_name, &opts);
args_fail("servo asks that you provide a URL") args_fail("servo asks that you provide a URL")
} else { } else {
let ref url = opt_match.free[0]; let ref url = opt_match.free[0];