diff --git a/doc/rust.md b/doc/rust.md index 0a33eb6ab2a..3c0828def15 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -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]); } ~~~~ diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index f524f1424b4..cdc0defcbca 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -11,7 +11,6 @@ use core::prelude::*; use core::io; -use core::str; pub struct ExpectedError { line: uint, kind: ~str, msg: ~str } diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 87f5f4bd3fa..2888d4223b7 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -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 diff --git a/src/libextra/net_url.rs b/src/libextra/net_url.rs index c85a866a04a..83cda31c680 100644 --- a/src/libextra/net_url.rs +++ b/src/libextra/net_url.rs @@ -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, ~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())); } diff --git a/src/libextra/rope.rs b/src/libextra/rope.rs index f23a4433289..de549641423 100644 --- a/src/libextra/rope.rs +++ b/src/libextra/rope.rs @@ -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; diff --git a/src/libextra/semver.rs b/src/libextra/semver.rs index c7d2010e609..3ab8bb1f60b 100644 --- a/src/libextra/semver.rs +++ b/src/libextra/semver.rs @@ -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; diff --git a/src/libfuzzer/fuzzer.rc b/src/libfuzzer/fuzzer.rc index 416fabb6d8f..dbeea417a3d 100644 --- a/src/libfuzzer/fuzzer.rc +++ b/src/libfuzzer/fuzzer.rc @@ -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; diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index b913a1b4996..8e015d9a677 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -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); diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index 8406444bd09..8b281487504 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -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), diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 30dd677396b..b12b1499759 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -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; diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs index d6623f06c3d..364d8b2d052 100644 --- a/src/librustc/middle/typeck/infer/to_str.rs +++ b/src/librustc/middle/typeck/infer/to_str.rs @@ -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; diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 8d0cba0e8b7..9556fd3e257 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -16,7 +16,6 @@ use syntax::visit; use core::hashmap::HashSet; use core::io; -use core::str; use extra; pub fn time(do_it: bool, what: ~str, thunk: &fn() -> T) -> T { diff --git a/src/librustpkg/version.rs b/src/librustpkg/version.rs index 434583eb79e..0900d93e498 100644 --- a/src/librustpkg/version.rs +++ b/src/librustpkg/version.rs @@ -143,7 +143,7 @@ fn try_parsing_version(s: &str) -> Option { 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('#') { diff --git a/src/libstd/io.rs b/src/libstd/io.rs index 409882c5cfe..58711360c35 100644 --- a/src/libstd/io.rs +++ b/src/libstd/io.rs @@ -1836,7 +1836,6 @@ mod tests { use io; use path::Path; use result; - use str; use u64; use vec; diff --git a/src/libstd/str.rs b/src/libstd/str.rs index e581eff83ad..8cd69f32e49 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -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 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 = diff --git a/src/libstd/str/ascii.rs b/src/libstd/str/ascii.rs index a4a1b7a171d..618d5095777 100644 --- a/src/libstd/str/ascii.rs +++ b/src/libstd/str/ascii.rs @@ -202,7 +202,6 @@ impl ToStrConsume for ~[Ascii] { #[cfg(test)] mod tests { use super::*; - use str; macro_rules! v2ascii ( ( [$($e:expr),*]) => ( [$(Ascii{chr:$e}),*]); diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 8a379a6213a..2e60f7d02df 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -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 { diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index db7c29edab0..3d6269942fd 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -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 { diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index 14cbd170c48..d3efd07aa04 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -21,7 +21,6 @@ use ext::base::*; use parse; use parse::token; -use core::str; use core::vec; enum State { diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs index cb7386b9880..1076c5d0b98 100644 --- a/src/libsyntax/ext/pipes/liveness.rs +++ b/src/libsyntax/ext/pipes/liveness.rs @@ -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) { diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 0c9ca98fb9d..e5a77cc21fb 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -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.", diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs index bc167e5124f..4029bd18338 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -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 to_str for ~[T] { fn to_str(&self) -> ~str { - ~"[" + self.map(|e| e.to_str()).connect(", ") + "]" + ~"[" + vec::map(*self, |e| e.to_str()).connect(", ") + "]" } }