fix tests, remove some warnings

This commit is contained in:
Huon Wilson 2013-06-11 02:34:14 +10:00
parent 2fa83c0503
commit e8782eeb63
22 changed files with 18 additions and 44 deletions

View File

@ -802,15 +802,15 @@ Use declarations support a number of convenient shortcuts:
An example of `use` declarations:
~~~~
use std::float::{sin, pow};
use std::option::Some;
use std::float::sin;
use std::option::{Some, None};
fn main() {
// Equivalent to 'info!(std::float::pow(std::float::sin(1.0), 2.0));'
info!(pow(sin(1.0), 2.0));
// Equivalent to 'info!(std::float::sin(1.0));'
info!(sin(1.0));
// Equivalent to 'info!(std::option::Some(1.0));'
info!(Some(1.0));
// Equivalent to 'info!(~[std::option::Some(1.0), std::option::None]);'
info!(~[Some(1.0), None]);
}
~~~~

View File

@ -11,7 +11,6 @@
use core::prelude::*;
use core::io;
use core::str;
pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }

View File

@ -16,7 +16,6 @@ use common;
use core::iterator::IteratorUtil;
use core::io;
use core::os;
use core::str;
pub struct TestProps {
// Lines that should be expected, in order, on standard out

View File

@ -19,7 +19,6 @@ use core::cmp::Eq;
use core::io::{Reader, ReaderUtil};
use core::io;
use core::hashmap::HashMap;
use core::str;
use core::to_bytes;
use core::uint;
@ -394,7 +393,7 @@ enum Input {
// returns userinfo, host, port, and unparsed part, or an error
fn get_authority(rawurl: &str) ->
Result<(Option<UserInfo>, ~str, Option<~str>, ~str), ~str> {
if !raw_url.starts_with("//") {
if !rawurl.starts_with("//") {
// there is no authority.
return Ok((None, ~"", None, rawurl.to_str()));
}

View File

@ -40,6 +40,7 @@ use core::prelude::*;
use core::iterator::IteratorUtil;
use core::uint;
use core::vec;
use core::str;
/// The type of ropes.
pub type Rope = node::Root;
@ -1187,8 +1188,6 @@ pub mod node {
pub mod char_iterator {
use core::prelude::*;
use core::str;
use rope::node::{Leaf, Node};
use rope::node::leaf_iterator;

View File

@ -20,7 +20,6 @@ use core::cmp;
use core::io::{ReaderUtil};
use core::io;
use core::option::{Option, Some, None};
use core::str;
use core::to_str::ToStr;
use core::uint;

View File

@ -37,7 +37,6 @@ use std::result;
use std::run;
use std::str;
use std::uint;
use std::vec;
use syntax::diagnostic;
use syntax::parse::token::ident_interner;

View File

@ -1995,7 +1995,7 @@ pub fn trans_enum_variant(ccx: @CrateContext,
debug!("trans_enum_variant: name=%s tps=%s repr=%? enum_ty=%s",
unsafe { str::raw::from_c_str(llvm::LLVMGetValueName(llfndecl)) },
~"[" + ty_param_substs.map(|&t| ty_to_str(ccx.tcx.connect(t)), ", ") + "]",
~"[" + ty_param_substs.map(|&t| ty_to_str(ccx.tcx, t)).connect(", ") + "]",
repr, ty_to_str(ccx.tcx, enum_ty));
adt::trans_start_init(bcx, repr, fcx.llretptr.get(), disr);

View File

@ -192,9 +192,7 @@ pub fn Invoke(cx: block,
terminate(cx, "Invoke");
debug!("Invoke(%s with arguments (%s))",
val_str(cx.ccx().tn, Fn),
vec::map(Args.connect(|a| val_str(cx.ccx().tn,
*a).to_owned()),
", "));
Args.map(|a| val_str(cx.ccx().tn, *a).to_owned()).connect(", "));
unsafe {
count_insn(cx, "invoke");
llvm::LLVMBuildInvoke(B(cx),

View File

@ -115,7 +115,6 @@ use core::iterator::IteratorUtil;
use core::cast::transmute;
use core::hashmap::HashMap;
use core::result;
use core::str;
use core::util::replace;
use core::vec;
use extra::list::Nil;

View File

@ -18,7 +18,6 @@ use middle::typeck::infer::InferCtxt;
use middle::typeck::infer::unify::{Redirect, Root, VarValue};
use util::ppaux::{mt_to_str, ty_to_str, trait_ref_to_str};
use core::str;
use core::uint;
use syntax::ast;

View File

@ -16,7 +16,6 @@ use syntax::visit;
use core::hashmap::HashSet;
use core::io;
use core::str;
use extra;
pub fn time<T>(do_it: bool, what: ~str, thunk: &fn() -> T) -> T {

View File

@ -143,7 +143,7 @@ fn try_parsing_version(s: &str) -> Option<Version> {
let s = s.trim();
debug!("Attempting to parse: %s", s);
let mut parse_state = Start;
for s.iter().advance |&c| {
for s.iter().advance |c| {
if char::is_digit(c) {
parse_state = SawDigit;
}
@ -171,7 +171,7 @@ fn is_url_like(p: &RemotePath) -> bool {
/// Otherwise, return None.
pub fn split_version<'a>(s: &'a str) -> Option<(&'a str, Version)> {
// reject strings with multiple '#'s
if s.splitn_iter('#', 2).count() > 1 {
if s.splitn_iter('#', 2).count() > 2 {
return None;
}
match s.rfind('#') {

View File

@ -1836,7 +1836,6 @@ mod tests {
use io;
use path::Path;
use result;
use str;
use u64;
use vec;

View File

@ -1800,7 +1800,7 @@ impl<'self> StrSlice<'self> for &'self str {
*/
#[inline]
fn substr(&self, begin: uint, n: uint) -> &'self str {
s.slice(begin, begin + count_bytes(s, begin, n))
self.slice(begin, begin + count_bytes(*self, begin, n))
}
/// Escape each char in `s` with char::escape_default.
#[inline]
@ -2318,7 +2318,6 @@ impl<'self> Iterator<u8> for StrBytesRevIterator<'self> {
mod tests {
use iterator::IteratorUtil;
use container::Container;
use char;
use option::Some;
use libc::c_char;
use libc;
@ -3026,14 +3025,6 @@ mod tests {
assert_eq!(~"YMCA", map("ymca", |c| unsafe {libc::toupper(c as c_char)} as char));
}
#[test]
fn test_chars() {
let ss = ~"ศไทย中华Việt Nam";
assert!(~['ศ','ไ','ท','ย','中','华','V','i','ệ','t',' ','N','a',
'm']
== to_chars(ss));
}
#[test]
fn test_utf16() {
let pairs =

View File

@ -202,7 +202,6 @@ impl ToStrConsume for ~[Ascii] {
#[cfg(test)]
mod tests {
use super::*;
use str;
macro_rules! v2ascii (
( [$($e:expr),*]) => ( [$(Ascii{chr:$e}),*]);

View File

@ -24,7 +24,6 @@ use syntax::parse::token::special_idents;
use core::cmp;
use core::hashmap::HashMap;
use core::str;
use core::vec;
pub enum path_elt {

View File

@ -23,7 +23,6 @@ use visit;
use core::hashmap::HashMap;
use core::int;
use core::option;
use core::str;
use core::to_bytes;
pub fn path_name_i(idents: &[ident]) -> ~str {

View File

@ -21,7 +21,6 @@ use ext::base::*;
use parse;
use parse::token;
use core::str;
use core::vec;
enum State {

View File

@ -42,7 +42,6 @@ use core::prelude::*;
use ext::base::ExtCtxt;
use ext::pipes::proto::{protocol_};
use core::str;
use extra::bitv::Bitv;
pub fn analyze(proto: @mut protocol_, _cx: @ExtCtxt) {

View File

@ -24,7 +24,6 @@ use parse::token;
use core::iterator::IteratorUtil;
use core::hashmap::HashMap;
use core::str;
use core::uint;
use core::vec;
@ -371,14 +370,14 @@ pub fn parse(
} else {
if (bb_eis.len() > 0u && next_eis.len() > 0u)
|| bb_eis.len() > 1u {
let nts = vec::map(bb_eis.connect(|ei| {
let nts = bb_eis.map(|ei| {
match ei.elts[ei.idx].node {
match_nonterminal(ref bind,ref name,_) => {
fmt!("%s ('%s')", *ident_to_str(name),
*ident_to_str(bind))
}
_ => fail!()
} }), " or ");
} }).connect(" or ");
return error(sp, fmt!(
"Local ambiguity: multiple parsing options: \
built-in NTs %s or %u other options.",

View File

@ -14,7 +14,8 @@
extern mod std;
use std::{str, int, vec};
use std::str::StrVector;
use std::{int, vec};
trait to_str {
fn to_str(&self) -> ~str;
@ -26,7 +27,7 @@ impl to_str for int {
impl<T:to_str> to_str for ~[T] {
fn to_str(&self) -> ~str {
~"[" + self.map(|e| e.to_str()).connect(", ") + "]"
~"[" + vec::map(*self, |e| e.to_str()).connect(", ") + "]"
}
}