about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-11-26 01:07:40 -0800
committerbors <bors@rust-lang.org>2013-11-26 01:07:40 -0800
commit21990cdda624f5eee340311b7f8e542ab8a218e1 (patch)
tree567d9df8a078d09fc610ea3e0b301f5cb6fb63d8 /src/libstd/rt
parentb42c4388927db75f9a38edbeafbfe13775b1773d (diff)
parent24b316a3b9567cb2cc2fb6644bd891dbf8855c18 (diff)
downloadrust-21990cdda624f5eee340311b7f8e542ab8a218e1.tar.gz
rust-21990cdda624f5eee340311b7f8e542ab8a218e1.zip
auto merge of #10622 : Kimundi/rust/str_de_iter, r=alexcrichton
This PR removes almost all `_iter` suffixes in various APIs of the codebase that return Iterators, as discussed in #9440.

As a summarize for the intend behind this PR:

- Iterators are the recommended way to provide a potentially lazy list of values, no need to name them painfully verbose. If anything, functions that return a specific container type should have more verbose names.
- We have a static type system, so no need to encode the return value of a constructor function into its name.

Following is a possibly incomplete list of all renamings I performed in the codebase. For a few of them I'm a bit unsure whether the new name still properly expresses their functionality, so feedback would be welcome:

~~~
&str : word_iter()             -> words()
       line_iter()             -> lines()
       any_line_iter()         -> lines_any()
       iter()                  -> chars()
       char_offset_iter()      -> char_indices()
       byte_iter()             -> bytes()
       split_iter()            -> split()
       splitn_iter()           -> splitn()
       split_str_iter()        -> split_str()
       split_terminator_iter() -> split_terminator()
       matches_index_iter()    -> match_indices()
       nfd_iter()              -> nfd_chars()
       nfkd_iter()             -> nfkd_chars()
      
&[T] : split_iter()        -> split()
       splitn_iter()       -> splitn()
       window_iter()       -> windows()
       chunk_iter()        -> chunks()
       permutations_iter() -> permutations()
      
extra:bitv::Bitv :  rev_liter()    -> rev_iter()
                    common_iter()  -> commons()
                    outlier_iter() -> outliers()

extra::treemap::{...} : lower_bound_iter() -> lower_bound()
                        upper_bound_iter() -> upper_bound()
                       
std::trie::{...} : bound_iter()       -> bound()
                   lower_bound_iter() -> lower_bound()
                   upper_bound_iter() -> upper_bound()

rustpkg::package_id::{...} : prefixes_iter() -> prefixes()

std::hashmap::{...} : difference_iter()           -> difference()
                      symmetric_difference_iter() -> symmetric_difference()
                      intersection_iter()         -> intersection()
                      union_iter()                -> union()
                     
std::path::{posix, windows} : component_iter()     -> components()
                              str_component_iter() -> str_components()

... not showing all identical renamings for reverse versions
~~~

---

I'm also planning a few more changes, like removing all unnecessary `_rev` constructors (#9391), or reducing the `split` variants on `&str` to a more versatile and concise system.
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/borrowck.rs2
-rw-r--r--src/libstd/rt/logging.rs4
-rw-r--r--src/libstd/rt/util.rs2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/rt/borrowck.rs b/src/libstd/rt/borrowck.rs
index d1f69ada301..2c78a32a4b6 100644
--- a/src/libstd/rt/borrowck.rs
+++ b/src/libstd/rt/borrowck.rs
@@ -17,7 +17,7 @@ use rt::env;
 use rt::local::Local;
 use rt::task;
 use rt::task::Task;
-use str::{OwnedStr, StrSlice};
+use str::OwnedStr;
 use str;
 use uint;
 use unstable::raw;
diff --git a/src/libstd/rt/logging.rs b/src/libstd/rt/logging.rs
index 55a6280a1f4..2ca47dbff59 100644
--- a/src/libstd/rt/logging.rs
+++ b/src/libstd/rt/logging.rs
@@ -63,8 +63,8 @@ fn parse_log_level(level: &str) -> Option<u32> {
 /// Also supports string log levels of error, warn, info, and debug
 fn parse_logging_spec(spec: ~str) -> ~[LogDirective]{
     let mut dirs = ~[];
-    for s in spec.split_iter(',') {
-        let parts: ~[&str] = s.split_iter('=').collect();
+    for s in spec.split(',') {
+        let parts: ~[&str] = s.split('=').collect();
         let mut log_level;
         let mut name = Some(parts[0].to_owned());
         match parts.len() {
diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs
index a1f867fd5f3..93721986f3c 100644
--- a/src/libstd/rt/util.rs
+++ b/src/libstd/rt/util.rs
@@ -77,7 +77,7 @@ pub fn dumb_println(args: &fmt::Arguments) {
 
 pub fn abort(msg: &str) -> ! {
     let msg = if !msg.is_empty() { msg } else { "aborted" };
-    let hash = msg.iter().fold(0, |accum, val| accum + (val as uint) );
+    let hash = msg.chars().fold(0, |accum, val| accum + (val as uint) );
     let quote = match hash % 10 {
         0 => "
 It was from the artists and poets that the pertinent answers came, and I