Skip to content

Commit

Permalink
auto merge of #5262 : servo/servo/fix-warnings, r=metajack
Browse files Browse the repository at this point in the history
  • Loading branch information
bors-servo committed Mar 18, 2015
2 parents a521755 + 6a58cbd commit 124a78f
Show file tree
Hide file tree
Showing 22 changed files with 52 additions and 59 deletions.
3 changes: 2 additions & 1 deletion components/compositing/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#![feature(box_syntax)]
#![feature(core)]
#![feature(int_uint)]
#![feature(io)]
#![feature(old_io)]
#![feature(old_path)]
#![feature(rustc_private)]
#![feature(std_misc)]

Expand Down
2 changes: 1 addition & 1 deletion components/compositing/scrolling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl ScrollingTimerProxy {
receiver: to_scrolling_timer_receiver,
};
scrolling_timer.run();
});
}).unwrap();
ScrollingTimerProxy {
sender: to_scrolling_timer_sender,
}
Expand Down
2 changes: 1 addition & 1 deletion components/devtools/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#![crate_name = "devtools"]
#![crate_type = "rlib"]

#![feature(int_uint, box_syntax, io, core, rustc_private)]
#![feature(int_uint, box_syntax, io, old_io, core, rustc_private)]
#![feature(collections, std_misc)]

#![allow(non_snake_case)]
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/display_list/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! They are therefore not exactly analogous to constructs like Skia pictures, which consist of
//! low-level drawing primitives.

#![deny(unsafe_blocks)]
#![deny(unsafe_code)]

use display_list::optimizer::DisplayListOptimizer;
use paint_context::{PaintContext, ToAzureRect};
Expand Down
5 changes: 2 additions & 3 deletions components/gfx/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
#![feature(box_syntax)]
#![feature(collections)]
#![feature(core)]
#![feature(hash)]
#![feature(int_uint)]
#![cfg_attr(any(target_os="linux", target_os = "android"), feature(io))]
#![cfg_attr(any(target_os="linux", target_os = "android"), feature(path))]
#![cfg_attr(any(target_os="linux", target_os = "android"), feature(old_io))]
#![cfg_attr(any(target_os="linux", target_os = "android"), feature(old_path))]
#![feature(plugin)]
#![feature(rustc_private)]
#![feature(std_misc)]
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/paint_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ impl WorkerThreadProxy {
font_cache_task,
time_profiler_chan);
worker_thread.main();
});
}).unwrap();
WorkerThreadProxy {
receiver: from_worker_receiver,
sender: to_worker_sender,
Expand Down
4 changes: 2 additions & 2 deletions components/gfx/platform/freetype/font_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn get_variations_for_family<F>(family_name: &str, mut callback: F)
let font_set_array_ptr = &mut font_set;
let pattern = FcPatternCreate();
assert!(!pattern.is_null());
let family_name_c = CString::from_slice(family_name.as_bytes());
let family_name_c = CString::new(family_name).unwrap();
let family_name = family_name_c.as_ptr();
let ok = FcPatternAddString(pattern, FC_FAMILY.as_ptr() as *mut c_char, family_name as *mut FcChar8);
assert!(ok != 0);
Expand Down Expand Up @@ -102,7 +102,7 @@ pub fn get_variations_for_family<F>(family_name: &str, mut callback: F)
}

pub fn get_system_default_family(generic_name: &str) -> Option<String> {
let generic_name_c = CString::from_slice(generic_name.as_bytes());
let generic_name_c = CString::new(generic_name).unwrap();
let generic_name_ptr = generic_name_c.as_ptr();

unsafe {
Expand Down
1 change: 0 additions & 1 deletion components/msg/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* 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/. */

#![feature(hash)]
#![feature(int_uint)]

extern crate azure;
Expand Down
4 changes: 3 additions & 1 deletion components/net/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
#![feature(box_syntax)]
#![feature(collections)]
#![feature(core)]
#![feature(env)]
#![feature(int_uint)]
#![feature(io)]
#![feature(old_io)]
#![feature(old_path)]
#![feature(path)]
#![feature(path_ext)]
#![feature(plugin)]
#![feature(rustc_private)]
#![feature(std_misc)]
Expand Down
2 changes: 1 addition & 1 deletion components/net/sniffer_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn new_sniffer_task() -> SnifferTask {
let builder = Builder::new().name("SnifferManager".to_string());
builder.spawn(move || {
SnifferManager::new(rec).start();
});
}).unwrap();
sen
}

Expand Down
13 changes: 4 additions & 9 deletions components/script/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
* 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/. */

#![feature(io)]

use std::old_io::process::{Command, ProcessExit, StdioContainer};

use std::process::Command;

fn main() {
let result = Command::new("make")
assert!(Command::new("make")
.args(&["-f", "makefile.cargo"])
.stdout(StdioContainer::InheritFd(1))
.stderr(StdioContainer::InheritFd(2))
.status()
.unwrap();
assert_eq!(result, ProcessExit::ExitStatus(0));
.unwrap()
.success());
}
1 change: 0 additions & 1 deletion components/script_traits/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* 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/. */

#![feature(core)]
#![feature(int_uint)]

extern crate devtools_traits;
Expand Down
25 changes: 13 additions & 12 deletions components/style/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,33 @@
* 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/. */

#![feature(env, old_io, old_path)]
#![feature(io, path)]

use std::env;
use std::old_path::Path;
use std::old_io::process::{Command, ProcessExit, StdioContainer};
use std::old_io::File;
use std::fs::File;
use std::io::Write;
use std::process::{Command, Stdio};
use std::path::Path;


fn main() {
let python = if Command::new("python2.7").arg("--version").status() == Ok(ProcessExit::ExitStatus(0)) {
let python = if Command::new("python2.7").arg("--version").status().unwrap().success() {
"python2.7"
} else {
"python"
};
let style = Path::new(file!()).dir_path();
let style = Path::new(file!()).parent().unwrap();
let mako = style.join("Mako-0.9.1.zip");
let template = style.join("properties.mako.rs");
let result = Command::new(python)
.env("PYTHONPATH", mako.as_str().unwrap())
.env("TEMPLATE", template.as_str().unwrap())
.env("PYTHONPATH", &mako)
.env("TEMPLATE", &template)
.arg("-c")
.arg("from os import environ; from mako.template import Template; print(Template(filename=environ['TEMPLATE']).render())")
.stderr(StdioContainer::InheritFd(2))
.stderr(Stdio::inherit())
.output()
.unwrap();
assert_eq!(result.status, ProcessExit::ExitStatus(0));
let out = Path::new(env::var("OUT_DIR").unwrap());
File::create(&out.join("properties.rs")).unwrap().write_all(&*result.output).unwrap();
assert!(result.status.success());
let out = env::var("OUT_DIR").unwrap();
File::create(&Path::new(&out).join("properties.rs")).unwrap().write_all(&result.stdout).unwrap();
}
2 changes: 1 addition & 1 deletion components/style/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* 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/. */

#![feature(alloc)]
#![feature(plugin)]
#![feature(int_uint)]
#![feature(box_syntax)]
#![feature(core)]
#![feature(std_misc)]
#![feature(collections)]
#![feature(rustc_private)]

Expand Down
2 changes: 1 addition & 1 deletion components/style/selector_matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use selectors::matching::{SelectorMap, Rule};
use selectors::matching::DeclarationBlock as GenericDeclarationBlock;
use selectors::parser::PseudoElement;
use selectors::smallvec::VecLike;
use selectors::tree::{TNode, TElement};
use selectors::tree::TNode;
use util::resource_files::read_resource_file;

use legacy::PresentationalHintSynthesis;
Expand Down
7 changes: 6 additions & 1 deletion components/util/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@
#![feature(box_syntax)]
#![feature(collections)]
#![feature(core)]
#![feature(env)]
#![feature(exit_status)]
#![feature(hash)]
#![feature(int_uint)]
#![feature(io)]
#![feature(optin_builtin_traits)]
#![feature(old_io)]
#![feature(old_path)]
#![feature(page_size)]
#![feature(path)]
#![feature(path_ext)]
#![feature(plugin)]
#![feature(rustc_private)]
#![feature(std_misc)]
#![feature(str_words)]
#![feature(unicode)]
#![feature(unsafe_destructor)]

Expand Down
4 changes: 2 additions & 2 deletions components/util/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,12 @@ fn get_jemalloc_stat(value_name: &str) -> Option<u64> {
// request. Without that jemalloc gives cached statistics(!) which can be
// highly inaccurate.
let epoch_name = "epoch";
let epoch_c_name = CString::from_slice(epoch_name.as_bytes());
let epoch_c_name = CString::new(epoch_name).unwrap();
let mut epoch: u64 = 0;
let epoch_ptr = &mut epoch as *mut _ as *mut c_void;
let mut epoch_len = size_of::<u64>() as size_t;

let value_c_name = CString::from_slice(value_name.as_bytes());
let value_c_name = CString::new(value_name).unwrap();
let mut value: size_t = 0;
let value_ptr = &mut value as *mut _ as *mut c_void;
let mut value_len = size_of::<size_t>() as size_t;
Expand Down
2 changes: 1 addition & 1 deletion components/util/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ macro_rules! int_range_index {

impl ::std::num::NumCast for $Self_ {
fn from<T: ToPrimitive>(n: T) -> Option<$Self_> {
n.to_int().map($Self_)
n.to_isize().map($Self_)
}
}

Expand Down
6 changes: 3 additions & 3 deletions components/util/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use cssparser::{self, RGBA, Color};
use libc::c_char;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::ffi::c_str_to_bytes;
use std::ffi::CStr;
use std::iter::Filter;
use std::num::{Int, ToPrimitive};
use std::str::{from_utf8, CharEq, FromStr, Split};
use std::str::{from_utf8, FromStr, Split};

pub type DOMString = String;
pub type StaticCharVec = &'static [char];
Expand Down Expand Up @@ -333,5 +333,5 @@ impl Str for LowercaseString {
/// Creates a String from the given null-terminated buffer.
/// Panics if the buffer does not contain UTF-8.
pub unsafe fn c_str_to_string(s: *const c_char) -> String {
from_utf8(c_str_to_bytes(&s)).unwrap().to_owned()
from_utf8(CStr::from_ptr(s).to_bytes()).unwrap().to_owned()
}
4 changes: 2 additions & 2 deletions components/util/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn spawn_named<F>(name: String, f: F)
let builder = thread::Builder::new().name(name);
builder.spawn(move || {
f()
});
}).unwrap();
}

/// Arrange to send a particular message to a channel if the task fails.
Expand All @@ -40,7 +40,7 @@ pub fn spawn_named_with_send_on_failure<F, T>(name: &'static str,
dest.send(msg).unwrap();
}
}
});
}).unwrap();
}

#[test]
Expand Down
1 change: 0 additions & 1 deletion ports/glutin/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#![feature(int_uint)]
#![feature(core)]
#![cfg_attr(feature = "window", feature(hash))]
#![feature(box_syntax)]

#[macro_use] extern crate bitflags;
Expand Down
17 changes: 5 additions & 12 deletions support/rust-task_info/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@
* 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/. */

#![feature(env)]
#![feature(io)]
#![feature(old_io)]

use std::old_io::process::{Command, ProcessExit, StdioContainer};
use std::process::Command;
use std::env;

fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let result = Command::new("make")
assert!(Command::new("make")
.args(&["-f", "makefile.cargo"])
.stdout(StdioContainer::InheritFd(1))
.stderr(StdioContainer::InheritFd(2))
.status()
.unwrap();
assert_eq!(result, ProcessExit::ExitStatus(0));
println!("cargo:rustc-flags=-L native={}", out_dir);
.unwrap()
.success());
println!("cargo:rustc-flags=-L native={}", env::var("OUT_DIR").unwrap());
}

0 comments on commit 124a78f

Please sign in to comment.