diff options
| author | bors <bors@rust-lang.org> | 2013-03-25 21:18:57 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-03-25 21:18:57 -0700 |
| commit | 47ddb59b802faa25b733416caf3d1b5588ab60a3 (patch) | |
| tree | d702d05254e66cd610af253811fc31061182991b | |
| parent | 02d5f090dcefb43625dc67d0d9147dbc9776c9b1 (diff) | |
| parent | 29e8b6ea9b63c5cc1cd91cc5eb756820f7fe50b7 (diff) | |
| download | rust-47ddb59b802faa25b733416caf3d1b5588ab60a3.tar.gz rust-47ddb59b802faa25b733416caf3d1b5588ab60a3.zip | |
auto merge of #5525 : dbaupp/rust/minor_fixups, r=graydon
Kills some warnings, and implements str::each_char_reverse so that it actually iterates. The test case wasn't detecting a failure, since the loop body was never executed.
| -rw-r--r-- | src/libcore/core.rc | 1 | ||||
| -rw-r--r-- | src/libcore/repr.rs | 1 | ||||
| -rw-r--r-- | src/libcore/str.rs | 19 | ||||
| -rw-r--r-- | src/libcore/vec.rs | 1 | ||||
| -rw-r--r-- | src/libfuzzer/fuzzer.rc | 1 | ||||
| -rw-r--r-- | src/librust/rust.rc | 2 | ||||
| -rw-r--r-- | src/librustc/driver/driver.rs | 1 | ||||
| -rw-r--r-- | src/librustc/middle/kind.rs | 2 | ||||
| -rw-r--r-- | src/librustc/rustc.rc | 1 | ||||
| -rw-r--r-- | src/librustdoc/rustdoc.rc | 1 | ||||
| -rw-r--r-- | src/librustdoc/trim_pass.rs | 2 | ||||
| -rw-r--r-- | src/librusti/rusti.rc | 1 | ||||
| -rw-r--r-- | src/librustpkg/rustpkg.rc | 1 | ||||
| -rw-r--r-- | src/libstd/std.rc | 1 |
14 files changed, 9 insertions, 26 deletions
diff --git a/src/libcore/core.rc b/src/libcore/core.rc index c97df636386..f38227de497 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -51,7 +51,6 @@ Implicitly, all crates behave as if they included the following prologue: #[warn(vecs_implicitly_copyable)]; #[deny(non_camel_case_types)]; #[allow(deprecated_mutable_fields)]; -#[deny(deprecated_self)]; #[allow(deprecated_drop)]; // On Linux, link to the runtime with -lrt. diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs index 07e7ae07840..39cc986f772 100644 --- a/src/libcore/repr.rs +++ b/src/libcore/repr.rs @@ -24,7 +24,6 @@ use managed; use ptr; use reflect; use reflect::{MovePtr, MovePtrAdaptor, align}; -use str; use sys; use to_str::ToStr; use vec::UnboxedVecRepr; diff --git a/src/libcore/str.rs b/src/libcore/str.rs index f26d9ee3492..92358c6a5e9 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -1020,22 +1020,21 @@ pub fn each_chari(s: &str, it: &fn(uint, char) -> bool) { /// Iterates over the chars in a string in reverse #[inline(always)] pub fn each_char_reverse(s: &str, it: &fn(char) -> bool) { - let mut pos = 0; - let len = s.char_len(); - while pos > 0 { - let CharRange {ch, next} = char_range_at_reverse(s, pos); - pos = next; - if !it(ch) { break; } - } + each_chari_reverse(s, |_, c| it(c)) } // Iterates over the chars in a string in reverse, with indices #[inline(always)] pub fn each_chari_reverse(s: &str, it: &fn(uint, char) -> bool) { + let mut pos = s.len(); let mut ch_pos = s.char_len(); - for s.each_char_reverse |ch| { + while pos > 0 { + let CharRange {ch, next} = char_range_at_reverse(s, pos); + pos = next; ch_pos -= 1; + if !it(ch_pos, ch) { break; } + } } @@ -3661,10 +3660,10 @@ mod tests { fn test_each_char_reverse() { let s = ~"ศไทย中华Việt Nam"; let v = ~['ศ','ไ','ท','ย','中','华','V','i','ệ','t',' ','N','a','m']; - let mut pos = 0; + let mut pos = v.len(); for s.each_char_reverse |ch| { + pos -= 1; fail_unless!(ch == v[pos]); - pos += 1; } } diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index a69655cd125..9def28fd3aa 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -2542,7 +2542,6 @@ impl<A:Clone> Clone for ~[A] { #[cfg(test)] mod tests { use option::{None, Option, Some}; - use option; use sys; use vec::*; use cmp::*; diff --git a/src/libfuzzer/fuzzer.rc b/src/libfuzzer/fuzzer.rc index 71f7072fa7f..3580edb5814 100644 --- a/src/libfuzzer/fuzzer.rc +++ b/src/libfuzzer/fuzzer.rc @@ -25,7 +25,6 @@ #[allow(non_camel_case_types)]; #[allow(deprecated_mode)]; #[allow(deprecated_pattern)]; -#[deny(deprecated_self)]; extern mod core(vers = "0.6"); extern mod std(vers = "0.6"); diff --git a/src/librust/rust.rc b/src/librust/rust.rc index b0edff033c3..e590586abbb 100644 --- a/src/librust/rust.rc +++ b/src/librust/rust.rc @@ -12,8 +12,6 @@ // FIXME #2238 Make commands run and test emit proper file endings on winds // FIXME #2238 Make run only accept source that emits an executable -#[deny(deprecated_self)]; - #[link(name = "rust", vers = "0.6", uuid = "4a24da33-5cc8-4037-9352-2cbe9bd9d27c", diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index a4fdd7f1b52..360a5ddccfd 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -25,7 +25,6 @@ use util::common::time; use util::ppaux; use core::int; -use core::io::WriterUtil; use core::io; use core::os; use core::str; diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index 02b0e17a346..0861e57c9b4 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -56,8 +56,6 @@ use syntax::{visit, ast_util}; // primitives in the stdlib are explicitly annotated to only take sendable // types. -use core::hashmap::linear::LinearSet; - pub static try_adding: &'static str = "Try adding a move"; pub type rval_map = HashMap<node_id, ()>; diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc index 60248687f3f..6a778a83361 100644 --- a/src/librustc/rustc.rc +++ b/src/librustc/rustc.rc @@ -24,7 +24,6 @@ #[allow(non_camel_case_types)]; #[allow(deprecated_mode)]; #[warn(deprecated_pattern)]; -#[deny(deprecated_self)]; #[no_core]; diff --git a/src/librustdoc/rustdoc.rc b/src/librustdoc/rustdoc.rc index 5cae8e31657..9eb3e816628 100644 --- a/src/librustdoc/rustdoc.rc +++ b/src/librustdoc/rustdoc.rc @@ -22,7 +22,6 @@ #[no_core]; #[allow(non_implicitly_copyable_typarams)]; -#[deny(deprecated_self)]; extern mod core(vers = "0.6"); extern mod std(vers = "0.6"); diff --git a/src/librustdoc/trim_pass.rs b/src/librustdoc/trim_pass.rs index 0adaed35d08..a1439e2e149 100644 --- a/src/librustdoc/trim_pass.rs +++ b/src/librustdoc/trim_pass.rs @@ -18,8 +18,6 @@ is interpreted as the brief description. use pass::Pass; use text_pass; -use core::str; - pub fn mk_pass() -> Pass { text_pass::mk_pass(~"trim", |s| s.trim().to_owned() ) } diff --git a/src/librusti/rusti.rc b/src/librusti/rusti.rc index 6a54dc7de10..e04cc9e3898 100644 --- a/src/librusti/rusti.rc +++ b/src/librusti/rusti.rc @@ -22,7 +22,6 @@ #[allow(vecs_implicitly_copyable, non_implicitly_copyable_typarams)]; -#[deny(deprecated_self)]; extern mod core(vers = "0.6"); extern mod std(vers = "0.6"); diff --git a/src/librustpkg/rustpkg.rc b/src/librustpkg/rustpkg.rc index 90d6fcbb8a5..2032969fbca 100644 --- a/src/librustpkg/rustpkg.rc +++ b/src/librustpkg/rustpkg.rc @@ -20,7 +20,6 @@ #[no_core]; #[allow(vecs_implicitly_copyable, non_implicitly_copyable_typarams)]; -#[deny(deprecated_self)]; extern mod core(vers = "0.6"); extern mod std(vers = "0.6"); diff --git a/src/libstd/std.rc b/src/libstd/std.rc index 6a7576645b8..aa5371671c1 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -28,7 +28,6 @@ not required in or otherwise suitable for the core library. #[allow(vecs_implicitly_copyable)]; #[deny(non_camel_case_types)]; -#[deny(deprecated_self)]; #[allow(deprecated_mutable_fields)]; #[no_core]; |
