about summary refs log tree commit diff
path: root/src/libextra
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-06-16 00:04:13 -0700
committerbors <bors@rust-lang.org>2013-06-16 00:04:13 -0700
commitf74e1935aa55aff7ecf9ac75a5114a7b41d4e56f (patch)
tree95cfabfbe2e63d3f42d0d8966d6b4af31ffb6c39 /src/libextra
parent8482d29d9b27a00e2d84bbf3bc0a3d14c61e34ba (diff)
parentbbcff95ac51f5533866d307a85eedb062a1a05da (diff)
auto merge of #7123 : huonw/rust/more-str, r=thestinger
Moves all the remaining functions that could reasonably be methods to be methods, except for some FFI ones (which I believe @erickt is working on, possibly) and `each_split_within`, since I'm not really sure the details of it (I believe @kimundi wrote the current implementation, so maybe he could convert it to an external iterator method on `StrSlice`, e.g. `word_wrap_iter(&self) -> WordWrapIterator<'self>`, where `WordWrapIterator` impls `Iterator<&'self str>`. It probably won't be too hard, since it's already a state machine.)

This also cleans up the comparison impls for the string types, except I'm not sure how the lang items `eq_str` and `eq_str_uniq` need to be handled, so they (`eq_slice` and `eq`) remain stand-alone functions.
Diffstat (limited to 'src/libextra')
-rw-r--r--src/libextra/base64.rs2
-rw-r--r--src/libextra/rope.rs1
-rw-r--r--src/libextra/sha1.rs3
-rw-r--r--src/libextra/smallintmap.rs5
-rw-r--r--src/libextra/sort.rs3
-rw-r--r--src/libextra/stats.rs1
-rw-r--r--src/libextra/std.rc1
-rw-r--r--src/libextra/tempfile.rs1
-rw-r--r--src/libextra/terminfo/parser/compiled.rs1
-rw-r--r--src/libextra/test.rs3
-rw-r--r--src/libextra/treemap.rs1
11 files changed, 2 insertions, 20 deletions
diff --git a/src/libextra/base64.rs b/src/libextra/base64.rs
index f4754b3e4cb..5bf4dd517a5 100644
--- a/src/libextra/base64.rs
+++ b/src/libextra/base64.rs
@@ -229,8 +229,6 @@ impl<'self> FromBase64 for &'self str {
 
 #[cfg(test)]
 mod tests {
-    use core::str;
-
     #[test]
     fn test_to_base64() {
         assert_eq!("".to_base64(), ~"");
diff --git a/src/libextra/rope.rs b/src/libextra/rope.rs
index 12539cd4759..fed73256c00 100644
--- a/src/libextra/rope.rs
+++ b/src/libextra/rope.rs
@@ -1271,7 +1271,6 @@ mod tests {
 
     use rope::*;
 
-    use core::str;
     use core::uint;
     use core::vec;
 
diff --git a/src/libextra/sha1.rs b/src/libextra/sha1.rs
index 0c35630345b..7c4b3f4ce39 100644
--- a/src/libextra/sha1.rs
+++ b/src/libextra/sha1.rs
@@ -24,7 +24,6 @@
 
 use core::prelude::*;
 
-use core::str;
 use core::uint;
 use core::vec;
 
@@ -279,8 +278,6 @@ pub fn sha1() -> @Sha1 {
 mod tests {
     use sha1;
 
-    use core::vec;
-
     #[test]
     fn test() {
         struct Test {
diff --git a/src/libextra/smallintmap.rs b/src/libextra/smallintmap.rs
index dae9113b3a9..972bccde18a 100644
--- a/src/libextra/smallintmap.rs
+++ b/src/libextra/smallintmap.rs
@@ -294,11 +294,6 @@ mod tests {
 
     use super::SmallIntMap;
 
-    use core::local_data;
-    use core::rand;
-    use core::uint;
-    use core::vec;
-
     #[test]
     fn test_find_mut() {
         let mut m = SmallIntMap::new();
diff --git a/src/libextra/sort.rs b/src/libextra/sort.rs
index 0189e0db6d4..b88fd374da2 100644
--- a/src/libextra/sort.rs
+++ b/src/libextra/sort.rs
@@ -751,7 +751,6 @@ fn shift_vec<T:Copy>(dest: &mut [T],
 mod test_qsort3 {
     use sort::*;
 
-    use core::vec;
 
     fn check_sort(v1: &mut [int], v2: &mut [int]) {
         let len = v1.len();
@@ -861,8 +860,6 @@ mod tests {
 
     use sort::*;
 
-    use core::vec;
-
     fn check_sort(v1: &[int], v2: &[int]) {
         let len = v1.len();
         pub fn le(a: &int, b: &int) -> bool { *a <= *b }
diff --git a/src/libextra/stats.rs b/src/libextra/stats.rs
index 4af47fa806f..3a1de5de01d 100644
--- a/src/libextra/stats.rs
+++ b/src/libextra/stats.rs
@@ -12,7 +12,6 @@
 
 use core::prelude::*;
 
-use core::vec;
 use core::f64;
 use core::cmp;
 use core::num;
diff --git a/src/libextra/std.rc b/src/libextra/std.rc
index 83c0bb516b4..93759bea35f 100644
--- a/src/libextra/std.rc
+++ b/src/libextra/std.rc
@@ -37,6 +37,7 @@ not required in or otherwise suitable for the core library.
 
 extern mod core(name = "std", vers = "0.7-pre");
 
+#[cfg(stage0)]
 use core::{str, unstable};
 use core::str::{StrSlice, OwnedStr};
 
diff --git a/src/libextra/tempfile.rs b/src/libextra/tempfile.rs
index c239e65e2d9..39dcee5eff3 100644
--- a/src/libextra/tempfile.rs
+++ b/src/libextra/tempfile.rs
@@ -36,7 +36,6 @@ mod tests {
     use tempfile::mkdtemp;
 
     use core::os;
-    use core::str;
 
     #[test]
     fn test_mkdtemp() {
diff --git a/src/libextra/terminfo/parser/compiled.rs b/src/libextra/terminfo/parser/compiled.rs
index 81b6083db01..66649c62fca 100644
--- a/src/libextra/terminfo/parser/compiled.rs
+++ b/src/libextra/terminfo/parser/compiled.rs
@@ -313,7 +313,6 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
 #[cfg(test)]
 mod test {
     use super::*;
-    use p = core::path::Path;
 
     #[test]
     fn test_veclens() {
diff --git a/src/libextra/test.rs b/src/libextra/test.rs
index a465cef09e6..72837cb4ae1 100644
--- a/src/libextra/test.rs
+++ b/src/libextra/test.rs
@@ -26,7 +26,6 @@ use core::either;
 use core::io;
 use core::option;
 use core::result;
-use core::str;
 use core::task;
 use core::to_str::ToStr;
 use core::uint;
@@ -542,7 +541,7 @@ pub fn filter_tests(
 
     // Sort the tests alphabetically
     fn lteq(t1: &TestDescAndFn, t2: &TestDescAndFn) -> bool {
-        str::le(t1.desc.name.to_str(), t2.desc.name.to_str())
+        t1.desc.name.to_str() < t2.desc.name.to_str()
     }
     sort::quick_sort(filtered, lteq);
 
diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs
index f98758f64af..e37ce7c71ef 100644
--- a/src/libextra/treemap.rs
+++ b/src/libextra/treemap.rs
@@ -710,7 +710,6 @@ mod test_treemap {
 
     use core::rand::RngUtil;
     use core::rand;
-    use core::str;
     use core::vec;
 
     #[test]