Skip to content

Commit e8782ee

Browse files
committedJun 10, 2013
fix tests, remove some warnings
1 parent 2fa83c0 commit e8782ee

File tree

22 files changed

+18
-44
lines changed

22 files changed

+18
-44
lines changed
 

‎doc/rust.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -802,15 +802,15 @@ Use declarations support a number of convenient shortcuts:
802802
An example of `use` declarations:
803803

804804
~~~~
805-
use std::float::{sin, pow};
806-
use std::option::Some;
805+
use std::float::sin;
806+
use std::option::{Some, None};
807807
808808
fn main() {
809-
// Equivalent to 'info!(std::float::pow(std::float::sin(1.0), 2.0));'
810-
info!(pow(sin(1.0), 2.0));
809+
// Equivalent to 'info!(std::float::sin(1.0));'
810+
info!(sin(1.0));
811811
812-
// Equivalent to 'info!(std::option::Some(1.0));'
813-
info!(Some(1.0));
812+
// Equivalent to 'info!(~[std::option::Some(1.0), std::option::None]);'
813+
info!(~[Some(1.0), None]);
814814
}
815815
~~~~
816816

‎src/compiletest/errors.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use core::prelude::*;
1212

1313
use core::io;
14-
use core::str;
1514

1615
pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }
1716

‎src/compiletest/header.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use common;
1616
use core::iterator::IteratorUtil;
1717
use core::io;
1818
use core::os;
19-
use core::str;
2019

2120
pub struct TestProps {
2221
// Lines that should be expected, in order, on standard out

‎src/libextra/net_url.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use core::cmp::Eq;
1919
use core::io::{Reader, ReaderUtil};
2020
use core::io;
2121
use core::hashmap::HashMap;
22-
use core::str;
2322
use core::to_bytes;
2423
use core::uint;
2524

@@ -394,7 +393,7 @@ enum Input {
394393
// returns userinfo, host, port, and unparsed part, or an error
395394
fn get_authority(rawurl: &str) ->
396395
Result<(Option<UserInfo>, ~str, Option<~str>, ~str), ~str> {
397-
if !raw_url.starts_with("//") {
396+
if !rawurl.starts_with("//") {
398397
// there is no authority.
399398
return Ok((None, ~"", None, rawurl.to_str()));
400399
}

‎src/libextra/rope.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ use core::prelude::*;
4040
use core::iterator::IteratorUtil;
4141
use core::uint;
4242
use core::vec;
43+
use core::str;
4344

4445
/// The type of ropes.
4546
pub type Rope = node::Root;
@@ -1187,8 +1188,6 @@ pub mod node {
11871188
pub mod char_iterator {
11881189
use core::prelude::*;
11891190

1190-
use core::str;
1191-
11921191
use rope::node::{Leaf, Node};
11931192
use rope::node::leaf_iterator;
11941193

‎src/libextra/semver.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use core::cmp;
2020
use core::io::{ReaderUtil};
2121
use core::io;
2222
use core::option::{Option, Some, None};
23-
use core::str;
2423
use core::to_str::ToStr;
2524
use core::uint;
2625

‎src/libfuzzer/fuzzer.rc

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use std::result;
3737
use std::run;
3838
use std::str;
3939
use std::uint;
40-
use std::vec;
4140

4241
use syntax::diagnostic;
4342
use syntax::parse::token::ident_interner;

‎src/librustc/middle/trans/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1995,7 +1995,7 @@ pub fn trans_enum_variant(ccx: @CrateContext,
19951995

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

‎src/librustc/middle/trans/build.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ pub fn Invoke(cx: block,
192192
terminate(cx, "Invoke");
193193
debug!("Invoke(%s with arguments (%s))",
194194
val_str(cx.ccx().tn, Fn),
195-
vec::map(Args.connect(|a| val_str(cx.ccx().tn,
196-
*a).to_owned()),
197-
", "));
195+
Args.map(|a| val_str(cx.ccx().tn, *a).to_owned()).connect(", "));
198196
unsafe {
199197
count_insn(cx, "invoke");
200198
llvm::LLVMBuildInvoke(B(cx),

‎src/librustc/middle/typeck/check/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ use core::iterator::IteratorUtil;
115115
use core::cast::transmute;
116116
use core::hashmap::HashMap;
117117
use core::result;
118-
use core::str;
119118
use core::util::replace;
120119
use core::vec;
121120
use extra::list::Nil;

‎src/librustc/middle/typeck/infer/to_str.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use middle::typeck::infer::InferCtxt;
1818
use middle::typeck::infer::unify::{Redirect, Root, VarValue};
1919
use util::ppaux::{mt_to_str, ty_to_str, trait_ref_to_str};
2020

21-
use core::str;
2221
use core::uint;
2322
use syntax::ast;
2423

‎src/librustc/util/common.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use syntax::visit;
1616

1717
use core::hashmap::HashSet;
1818
use core::io;
19-
use core::str;
2019
use extra;
2120

2221
pub fn time<T>(do_it: bool, what: ~str, thunk: &fn() -> T) -> T {

‎src/librustpkg/version.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn try_parsing_version(s: &str) -> Option<Version> {
143143
let s = s.trim();
144144
debug!("Attempting to parse: %s", s);
145145
let mut parse_state = Start;
146-
for s.iter().advance |&c| {
146+
for s.iter().advance |c| {
147147
if char::is_digit(c) {
148148
parse_state = SawDigit;
149149
}
@@ -171,7 +171,7 @@ fn is_url_like(p: &RemotePath) -> bool {
171171
/// Otherwise, return None.
172172
pub fn split_version<'a>(s: &'a str) -> Option<(&'a str, Version)> {
173173
// reject strings with multiple '#'s
174-
if s.splitn_iter('#', 2).count() > 1 {
174+
if s.splitn_iter('#', 2).count() > 2 {
175175
return None;
176176
}
177177
match s.rfind('#') {

‎src/libstd/io.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1836,7 +1836,6 @@ mod tests {
18361836
use io;
18371837
use path::Path;
18381838
use result;
1839-
use str;
18401839
use u64;
18411840
use vec;
18421841

‎src/libstd/str.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@ impl<'self> StrSlice<'self> for &'self str {
18001800
*/
18011801
#[inline]
18021802
fn substr(&self, begin: uint, n: uint) -> &'self str {
1803-
s.slice(begin, begin + count_bytes(s, begin, n))
1803+
self.slice(begin, begin + count_bytes(*self, begin, n))
18041804
}
18051805
/// Escape each char in `s` with char::escape_default.
18061806
#[inline]
@@ -2318,7 +2318,6 @@ impl<'self> Iterator<u8> for StrBytesRevIterator<'self> {
23182318
mod tests {
23192319
use iterator::IteratorUtil;
23202320
use container::Container;
2321-
use char;
23222321
use option::Some;
23232322
use libc::c_char;
23242323
use libc;
@@ -3026,14 +3025,6 @@ mod tests {
30263025
assert_eq!(~"YMCA", map("ymca", |c| unsafe {libc::toupper(c as c_char)} as char));
30273026
}
30283027
3029-
#[test]
3030-
fn test_chars() {
3031-
let ss = ~"ศไทย中华Việt Nam";
3032-
assert!(~['ศ','ไ','ท','ย','中','华','V','i','ệ','t',' ','N','a',
3033-
'm']
3034-
== to_chars(ss));
3035-
}
3036-
30373028
#[test]
30383029
fn test_utf16() {
30393030
let pairs =

‎src/libstd/str/ascii.rs

-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ impl ToStrConsume for ~[Ascii] {
202202
#[cfg(test)]
203203
mod tests {
204204
use super::*;
205-
use str;
206205

207206
macro_rules! v2ascii (
208207
( [$($e:expr),*]) => ( [$(Ascii{chr:$e}),*]);

‎src/libsyntax/ast_map.rs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use syntax::parse::token::special_idents;
2424

2525
use core::cmp;
2626
use core::hashmap::HashMap;
27-
use core::str;
2827
use core::vec;
2928

3029
pub enum path_elt {

‎src/libsyntax/ast_util.rs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use visit;
2323
use core::hashmap::HashMap;
2424
use core::int;
2525
use core::option;
26-
use core::str;
2726
use core::to_bytes;
2827

2928
pub fn path_name_i(idents: &[ident]) -> ~str {

‎src/libsyntax/ext/asm.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use ext::base::*;
2121
use parse;
2222
use parse::token;
2323

24-
use core::str;
2524
use core::vec;
2625

2726
enum State {

‎src/libsyntax/ext/pipes/liveness.rs

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ use core::prelude::*;
4242
use ext::base::ExtCtxt;
4343
use ext::pipes::proto::{protocol_};
4444

45-
use core::str;
4645
use extra::bitv::Bitv;
4746

4847
pub fn analyze(proto: @mut protocol_, _cx: @ExtCtxt) {

‎src/libsyntax/ext/tt/macro_parser.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use parse::token;
2424

2525
use core::iterator::IteratorUtil;
2626
use core::hashmap::HashMap;
27-
use core::str;
2827
use core::uint;
2928
use core::vec;
3029

@@ -371,14 +370,14 @@ pub fn parse(
371370
} else {
372371
if (bb_eis.len() > 0u && next_eis.len() > 0u)
373372
|| bb_eis.len() > 1u {
374-
let nts = vec::map(bb_eis.connect(|ei| {
373+
let nts = bb_eis.map(|ei| {
375374
match ei.elts[ei.idx].node {
376375
match_nonterminal(ref bind,ref name,_) => {
377376
fmt!("%s ('%s')", *ident_to_str(name),
378377
*ident_to_str(bind))
379378
}
380379
_ => fail!()
381-
} }), " or ");
380+
} }).connect(" or ");
382381
return error(sp, fmt!(
383382
"Local ambiguity: multiple parsing options: \
384383
built-in NTs %s or %u other options.",

‎src/test/run-pass/trait-to-str.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
extern mod std;
1616

17-
use std::{str, int, vec};
17+
use std::str::StrVector;
18+
use std::{int, vec};
1819

1920
trait to_str {
2021
fn to_str(&self) -> ~str;
@@ -26,7 +27,7 @@ impl to_str for int {
2627

2728
impl<T:to_str> to_str for ~[T] {
2829
fn to_str(&self) -> ~str {
29-
~"[" + self.map(|e| e.to_str()).connect(", ") + "]"
30+
~"[" + vec::map(*self, |e| e.to_str()).connect(", ") + "]"
3031
}
3132
}
3233

0 commit comments

Comments
 (0)